tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Gainty" <mgai...@hotmail.com>
Subject Re: Help getting MySQL connected to Tomcat
Date Sun, 24 Feb 2008 16:45:43 GMT
Hi Kevin-

is there a MySQL listener installed on port 3306..you can verify with
netstat -a | grep 3306?
If so can you connect using mySQL client?

M-
----- Original Message -----
From: <kevin@witten-enterprises.com>
To: <users@tomcat.apache.org>
Sent: Saturday, February 23, 2008 9:00 PM
Subject: Help getting MySQL connected to Tomcat


Hello,

I'm trying to get Tomcat and MySQL to connect. I have the following
installations:

Tomcat V5.5.26
MySQL V5.0
mysql connector 5.1.5 from the mysql site (copied the jar to
<tomcat>\common\lib

I've tried following the directions from the tomcat dist and from the mysql
dist but I always get can't connect exceptions when I start tomcat.

In mysql I've created a user=javauser with password=javadude and I created a
database called javatest with one table and some data in the table.
I can connect to the database from the console using "C:> mysql -u
javauser -p" and I can then connect to the javatest DB and select * from the
table works fine.

Then I added the following to in the <tomcat>/conf/context.xml file

<Context path="/db-servlet" docBase="db-servlet" debug="5" reloadable="true"
crossContext="true">

   <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"

               maxActive="100" maxIdle="30" maxWait="10000"

               username="javauser" password="javadude"
driverClassName="com.mysql.jdbc.Driver"

               url="jdbc:mysql://localhost:3306/javatest"/>

</Context>



And I stop tomcat, and when I restart tomcat I get the following in the
catalina log:



..

INFO: Stopping Coyote HTTP/1.1 on http-8080

Feb 23, 2008 8:31:19 AM org.apache.catalina.core.AprLifecycleListener
lifecycleEvent

INFO: Failed shutdown of Apache Portable Runtime

Feb 23, 2008 8:37:40 AM org.apache.catalina.startup.Catalina stopServer

SEVERE: Catalina.stop:

java.net.ConnectException: Connection refused: connect

      at java.net.PlainSocketImpl.socketConnect(Native Method)

      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

      at java.net.Socket.connect(Socket.java:520)

      at java.net.Socket.connect(Socket.java:470)

      at java.net.Socket.<init>(Socket.java:367)

      at java.net.Socket.<init>(Socket.java:180)

      at org.apache.catalina.startup.Catalina.stopServer(Catalina.java:395)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)

      at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
java:25)

      at java.lang.reflect.Method.invoke(Method.java:585)

      at
org.apache.catalina.startup.Bootstrap.stopServer(Bootstrap.java:344)

      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:435)





So why the connection refused?



Any help is appreciated.



Thanks,

Kevin






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


Mime
View raw message