开发者

Unable to connect to mysql database using tomcat6 on ubuntu

开发者 https://www.devze.com 2022-12-27 13:37 出处:网络
I am able to deploy the application on my local system.... connecting to the same remote database... however when I deploy the same war file on the ubuntu server I get the following exception

I am able to deploy the application on my local system.... connecting to the same remote database... however when I deploy the same war file on the ubuntu server I get the following exception

javax.servlet.ServletException: Could not connect to wikipedia database...
    org.wikipedia.miner.service.WikipediaMinerServlet.init(WikipediaMinerServlet.java:81)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    java.lang.reflect.Method.invoke(Method.java:616)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:537)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:115)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    java.lang.Thread.run(Thread.java:636)

I have even placed the mysql connector jar unde开发者_StackOverflowr tomcat6 lib direcotry.... Please help


Are the two MySQL servers configured identically? Both allow access via TCP sockets and/or local Unix-domain sockets?

"Could not connect" suggests that JDBC can't even reach the server to try and log in. If you're connecting via TCP, check if there's a firewall rule in place preventing local connections (localhost:* -> localhost:3306 is denied). For local sockets, check that the user Tomcat's running under has access to both the socket file, AND the directory it resides in (should be /var/run/mysqld/mysqld.sock).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号