views:

341

answers:

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

A: 

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

Marc B
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.
Rakesh
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?
Marc B
I mean the first one " "localsystem.yoursite.com" and "ubuntuntuserver.yoursite.com" both connect to a mysql instance running on 'ubuntuserver.yoursite.com'"
Rakesh
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).
Marc B