On Nov 18, 2008, at 7:36 , Antonio Vidal Ferrer wrote:

Hi,

It's your mysql listening on Localhost?
Have you tried to use the ip address instead of Localhost?


Best,

Toni

-----Original Message-----
From: Krapacs Ambrose [mailto:[EMAIL PROTECTED]
Sent: martes, 18 de noviembre de 2008 13:22
To: users@tomcat.apache.org
Subject: Servlets / JSP can't connect to MySQL in Ubuntu Server

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.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Yes I'm sure it is listening on localhost. In /etc/mysql/my.cnf the bind-address is set to 127.0.0.1 and also I explained that the standalone j2se java application successfully connected to the MySQL server via the MySQL JDBC connector. However I have tried using the ip address, and I have also tried different combinations specifying and omitting the port. Still no luck :(

Reply via email to