android soap调用异常

时间:2012-10-27 03:48:35

标签: java exception soap exception-handling

您好我必须使用soap webservices开发带有mysql数据库连接的android登录。

它成功运作了我的( localhost / phpmyadmin

Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/androidlogin","root","");

但它在我的开发网站上无效:( dev.www.com/phpmyadmin

Connection con = DriverManager.getConnection("jdbc:mysql://dev.www.com:3306/login","mm2","mm5");

我使用上面的代码意味着我得到以下错误。请给我如何解决此错误。

低于错误:

  java.sql.SQLException: Unable to connect to any hosts due to exception:      java.net.SocketException: java.net.ConnectException: Operation timed out

 ** BEGIN NESTED EXCEPTION ** 

 java.net.SocketException
 MESSAGE: java.net.ConnectException: Operation timed out

 STACKTRACE:

 java.net.SocketException: java.net.ConnectException: Operation timed out
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:143)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:225)
 at com.mysql.jdbc.Connection.createNewIO(Connection.java:1805)
 at com.mysql.jdbc.Connection.<init>(Connection.java:452)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
 at java.sql.DriverManager.getConnection(DriverManager.java:582)
 at java.sql.DriverManager.getConnection(DriverManager.java:185)
 at com.xcart.Login.authentication(Login.java:16)
 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:597)
 at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
 at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
 at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
 at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
 at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
 at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
 at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
 at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
 at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
 at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
 at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:680)


  ** END NESTED EXCEPTION **


  at com.mysql.jdbc.Connection.createNewIO(Connection.java:1875)
  at com.mysql.jdbc.Connection.<init>(Connection.java:452)
  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411)
  at java.sql.DriverManager.getConnection(DriverManager.java:582)
  at java.sql.DriverManager.getConnection(DriverManager.java:185)
  at com.xcart.Login.authentication(Login.java:16)
  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:597)
  at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
  at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
  at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
  at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
  at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
  at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
  at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
  at java.lang.Thread.run(Thread.java:680)

1 个答案:

答案 0 :(得分:1)

这不是代码问题。这是你环境中的一些东西,所以我不确定这里有多少人可以帮助你。这里有几个提示。异常消息是:

java.net.ConnectException: Operation timed out

这排除了一些事情。如果您能够访问主机www.dev.com但是mysql没有运行,那么您将获得java.net.ConnectException: Connection refused。如果您错误输入了地址(例如www.dev.comm),您会得到java.net.UnknownHostException: <host name>

不幸的是,你得到了超时错误。这意味着主机名已成功解析为一个地址,但是当您尝试连接到该地址时,您无法从计算机中得到任何响应。这通常意味着两件事之一:

  • 有人关掉电脑
  • 您和计算机之间已打开防火墙,防火墙不允许端口3306上的tcp连接。

我猜它是防火墙。祝好运。希望这会有所帮助。