Destination Host Unreachable e Communications link falha quando me conecto ao banco de dados MySQL usando a biblioteca D2RQ

1

Eu tenho uma pergunta:

Eu tenho um serviço web que roda em uma máquina virtual localizada em um servidor remoto com o sistema operacional Ubuntu 12.04.

Agora, quero testar este serviço da Web e estou usando este código que desenvolvi em meu cliente de serviço da Web:

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);
    }
}

Este código deseja selecionar informações de conexão para um banco de dados e fornecê-las ao meu serviço da Web. Em seguida, meu serviço da Web usará a biblioteca D2RQ para converter informações no banco de dados para RDF. Meu cliente de serviço da Web é criado usando o endereço IP da máquina virtual.

Quando executo este código, recebo este erro:

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

Eu não recebo este erro se eu executar este código em local. Na verdade, se eu criar meu cliente de serviço da Web usando o endereço IP do serviço da Web na máquina local, não receberei esse erro. Por que recebo esse erro?

Eu tentei um ping da máquina virtual para o host mysql e recebi "Destination Host Unreachable". Por quê?

    
por Musich87 16.01.2015 / 17:05

0 respostas