I have a question:
I have a web service which runs on a virtual machine located on a remote server with Ubuntu 12.04 operating system.
Now, I want to test this Web Service and I'm using this code that I have developed in my Web Service Client:
public class Client3 {
public static void main(String[] args) {
byte[] inputFile;
String nomeFile;
String jdbcURL = "jdbc:mysql://xxx.xxx.xxx.xxx:3306/mydb";
String username = "root";
String password = "xxx";
String driver = "com.mysql.jdbc.Driver";
String result = wsmethod(jdbcURL, username, password, driver);
private static String wsmethod(java.lang.String jdbcURL, java.lang.String username, java.lang.String password, java.lang.String driver) {
ws.myWs_Service service = new ws.myWs_Service();
ws.myWs port = service.getmyWsPort();
return port.wsmethod(jdbcURL, username, password, driver);
}
}
This code wants to pick connection information to a database and provide it to my Web Service. Then, my Web Service will use D2RQ library to convert information in the database to RDF. My Web Service Client is created using the IP address of the virtual machine.
When I run this code, I get this error:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Database connection to jdbc:mysql://xxx.xxx.xxx.xxx:3306/mydb failed (user: root): Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. (E54)
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:125)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
at com.sun.proxy.$Proxy31.wsmethod(Unknown Source)
at client3.Client3.wsmethod(Client3.java:77)
at client3.Client3.main(Client3.java:70)
Caused by: de.fuberlin.wiwiss.d2rq.D2RQException: Database connection to jdbc:mysql://xxx.xxx.xxx.xxx:3306/mydb failed (user: root): Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. (E54)
at de.fuberlin.wiwiss.d2rq.sql.ConnectedDB.connect(ConnectedDB.java:201)
at de.fuberlin.wiwiss.d2rq.sql.ConnectedDB.connection(ConnectedDB.java:170)
at de.fuberlin.wiwiss.d2rq.dbschema.DatabaseSchemaInspector.<init>(DatabaseSchemaInspector.java:45)
at de.fuberlin.wiwiss.d2rq.sql.ConnectedDB.schemaInspector(ConnectedDB.java:243)
at de.fuberlin.wiwiss.d2rq.mapgen.MappingGenerator.<init>(MappingGenerator.java:77)
at de.fuberlin.wiwiss.d2rq.SystemLoader.openMappingGenerator(SystemLoader.java:224)
at Prova.classprova.methodprova(classprova.java:70)
at WS.SmartHealth_ws.wsmethod(myWs.java:249)
at sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:95)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:629)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:588)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:573)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:470)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:295)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:515)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:285)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:143)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:155)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:189)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1081)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1566)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1523)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Java Result: 1
I don't get this error if I run this code in local. In fact, if I create my Web Service Client using the IP address of the Web Service in local machine, I don't get this error. Why do I get this error?