I have tried many different configurations and I have been unable to
get my Servlets / JSP to connect to MySQL server running. I am trying
to get this set up on my main server which is running Ubuntu 8.10
Server with MySQL 5 and Tomcat6. I also tried setting up a Ubuntu 8.04
server with Tomcat 5.5 and MySQL 5. I have even configured Tomcat
running on the 8.10 server to try to connect to MySQL running on the
8.04 server. Still no luck!
The exception that is thrown is here:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
Communications link failure
Last packet sent to the server was 0 ms ago.(jdbc:mysql://localhost?
user=invuser&password=admin))
org
.apache
.jasper
.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
org.apache.jasper.runtime.PageContextImpl.access
$1100(PageContextImpl.java:71)
org.apache.jasper.runtime.PageContextImpl$12.run(PageContextImpl.java:
768)
java.security.AccessController.doPrivileged(Native Method)
org
.apache
.jasper
.runtime.PageContextImpl.handlePageException(PageContextImpl.java:766)
org.apache.jsp.install_jsp._jspService(install_jsp.java:141)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org
.apache
.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:
342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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)
I have verified that MySQL is running and everything with Tomcat seems
to be configured correctly because I can execute servlets and JSP just
fine it's just the connections to MySql to that fail. I have also
executed a standalone java application using the MySQL Connector/J and
that worked fine. I've even tried different ways of deploying the
MySql Connector/J (which is the newest version available) to see if it
was a permissions problem with the library.
The key to this is that the web applications that I am trying to
deploy run flawlessly on my Mac OS X development machine with MySQL. I
haven't tried Windows yet but if I can get this set up to host my web
application I may have to set up a Windows machine to try it.