Use axis to develop the WebService java.net. connectexception: Connection refused: connect exception Solution

Source: Internet
Author: User

Recently, using axis to develop the WebService, the local call is normal, but others cannot access it. The error message is:

Axisfault
Faultcode: {http://schemas.xmlsoap.org/soap/envelope/}server.userexception
Faultsubcode:
Faultstring: java.net. connectexception: Connection refused: connect
Faultactor:
Faultnode:
Faultdetail:
{Http://xml.apache.org/axis/?stacktrace:java.net.connectexception: connection refused: connect
At java.net. plainsocketimpl. socketconnect (native method)
At java.net. plainsocketimpl. doconnect (plainsocketimpl. Java: 333)
At java.net. plainsocketimpl. connecttoaddress (plainsocketimpl. Java: 195)
At java.net. plainsocketimpl. Connect (plainsocketimpl. Java: 182)
At java.net. sockssocketimpl. Connect (sockssocketimpl. Java: 366)
At java.net. Socket. Connect (socket. Java: 516)
At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)
At sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25)
At java. Lang. Reflect. method. Invoke (method. Java: 585)
At org.apache.axis.components.net. defaultsocketfactory. Create (defasocksocketfactory. Java: 153)
At org.apache.axis.components.net. defaultsocketfactory. Create (defasocksocketfactory. Java: 120)
At org. Apache. axis. Transport. http. httpsender. getsocket (httpsender. Java: 191)
At org. Apache. axis. Transport. http. httpsender. writetosocket (httpsender. Java: 404)
At org. Apache. axis. Transport. http. httpsender. Invoke (httpsender. Java: 138)
At org. Apache. axis. Strategies. invocationstrategy. Visit (invocationstrategy. Java: 32)
At org. Apache. axis. simplechain. dovisiting (simplechain. Java: 118)
At org. Apache. axis. simplechain. Invoke (simplechain. Java: 83)
At org. Apache. axis. Client. axisclient. Invoke (axisclient. Java: 165)
At org. Apache. axis. Client. Call. invokeengine (call. Java: 2784)
At org. Apache. axis. Client. Call. Invoke (call. Java: 2767)
At org. Apache. axis. Client. Call. Invoke (call. Java: 2443)
At org. Apache. axis. Client. Call. Invoke (call. Java: 2366)
At org. Apache. axis. Client. Call. Invoke (call. Java: 1812)
At com. sendserver. tongdaows. invokewg (tongdaows. Java: 114)
At sun. Reflect. nativemethodaccessorimpl. invoke0 (native method)
At sun. Reflect. nativemethodaccessorimpl. Invoke (nativemethodaccessorimpl. Java: 39)
At sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25)
At java. Lang. Reflect. method. Invoke (method. Java: 585)
At org. Apache. axis. providers. java. rpcprovider. invokemethod (rpcprovider. Java: 397)
At org. Apache. axis. providers. java. rpcprovider. processmessage (rpcprovider. Java: 186)
At org. Apache. axis. providers. java. javaprovider. Invoke (javaprovider. Java: 323)
At org. Apache. axis. Strategies. invocationstrategy. Visit (invocationstrategy. Java: 32)
At org. Apache. axis. simplechain. dovisiting (simplechain. Java: 118)
At org. Apache. axis. simplechain. Invoke (simplechain. Java: 83)
At org. Apache. axis. Handlers. Soap. soapservice. Invoke (soapservice. Java: 454)
At org. Apache. axis. server. axisserver. Invoke (axisserver. Java: 281)
At org. Apache. axis. Transport. http. axisservlet. dopost (axisservlet. Java: 699)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 710)
At org. Apache. axis. Transport. http. axisservletbase. Service (axisservletbase. Java: 327)
At javax. servlet. http. httpservlet. Service (httpservlet. Java: 803)
At org. Apache. Catalina. Core. applicationfilterchain. internaldofilter (applicationfilterchain. Java: 290)
At org. Apache. Catalina. Core. applicationfilterchain. dofilter (applicationfilterchain. Java: 206)
At org. Apache. Catalina. Core. standardwrappervalve. Invoke (standardwrappervalve. Java: 233)
At org. Apache. Catalina. Core. standardcontextvalve. Invoke (standardcontextvalve. Java: 175)
At org. Apache. Catalina. Core. standardhostvalve. Invoke (standardhostvalve. Java: 128)
At org. Apache. Catalina. Valves. errorreportvalve. Invoke (errorreportvalve. Java: 102)
At org. Apache. Catalina. Core. standardenginevalve. Invoke (standardenginevalve. Java: 109)
At org. Apache. Catalina. connector. coyoteadapter. Service (coyoteadapter. Java: 286)
At org. Apache. Coyote. http11.http11processor. Process (http11processor. Java: 844)
At org. Apache. Coyote. http11.http11protocol $ http11connectionhandler. Process (http11protocol. Java: 583)
At org.apache.tomcat.util.net. jioendpoint $ worker. Run (jioendpoint. Java: 447)
At java. Lang. thread. Run (thread. Java: 595)

After a day, I finally found the mystery of the problem. Originally, the WSDL file automatically generated by axis is faulty. In its wddlsoap tag, localhost is used as the access address,

<Wsdlsoap: address location = "http: // localhost: 8080/axis/services/test"/>

In this case, only access from the local machine is normal and access from other machines fails. The solution is to modify this address. For example, if your address is 10.154.23.153, change this address

<Wsdlsoap: address location = "http: // 10.154.23.153: 8080/axis/services/test"/>

In this way, the problem is solved.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.