1

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 under tomcat6 lib direcotry.... Please help

2
  • Maybe you'll have to grant connection from the local IP address. Check the privileges at the mysql level. Commented Apr 18, 2010 at 23:58
  • I am unable to understand your statement clearly ....I am using the same username and password that i use in my local system here i can connect through my local system but i get an error when in deploy the application on the server machine where mysql resides Commented Apr 19, 2010 at 7:17

1 Answer 1

1

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).

Sign up to request clarification or add additional context in comments.

4 Comments

From local system and from the ubuntu server I connect to the same mysql database. The mysql database is present on the same ubuntu machine.
So on "localsystem.yoursite.com" and "ubuntuntuserver.yoursite.com" both connect to a mysql instance running on 'ubuntuserver.yoursite.com'? Or do you mean each server has its own copy of mysql, and within each copy of mysql the same set of databases/records exists?
I mean the first one " "localsystem.yoursite.com" and "ubuntuntuserver.yoursite.com" both connect to a mysql instance running on 'ubuntuserver.yoursite.com'"
Then you'll have to check if the MySQL instance on ubuntuserver is configured to accept TCP connections. There's options in the my.cnf/my.ini file for that, as well as command line arguments to control TCP networking. You can trivially check if MySQL is listening to TCP ports with netstat -tan|grep 3306 and see if anything comes back (assuming MySQL's not been configured to use a different port).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.