tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From A Df <abbey_dragonfor...@yahoo.com>
Subject Tomcat 6 not working with JDBC driver for MySQL
Date Mon, 25 Jul 2011 20:40:45 GMT
Dear All:=0A=0AI have read numerous posts and documentation and now I reall=
y need help.=0A=0A=0AI am using the following:=0A=0AProduct Version: NetBea=
ns IDE 7.0 (Build 201104080000)=0AJava: 1.6.0_26; Java HotSpot(TM) Client V=
M 20.1-b02=0ASystem: Windows 7 version 6.1 running on x86; =0AApache Tomcat=
 6.0.26=0AMySQL Version: 5.5.14=0AMySQL Connector/J JDBC Driver 5.1.17=0A=
=0A=0AI performed the steps below as follows:=0A=0AI have added the MySQL C=
onnector/J JDBC Driver to the $CATALINA_HOME/lib directory=0A=0AI have modi=
fy the web application deployment descriptor (/WEB-INF/web.xml) =0A<CODE>=
=0A<?xml version=3D"1.0" encoding=3D"UTF-8"?>=0A<web-app version=3D"2.5" xm=
lns=3D"http://java.sun.com/xml/ns/javaee" xmlns:xsi=3D"http://www.w3.org/20=
01/XMLSchema-instance"=0A xsi:schemaLocation=3D"http://java.sun.com/xml/ns/=
javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">=0A=C2=A0=C2=A0=
=C2=A0 <session-config>=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <sessi=
on-timeout>=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 30=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </session-timeout>=
=0A=C2=A0=C2=A0=C2=A0 </session-config>=0A=C2=A0=C2=A0=C2=A0 <welcome-file-=
list>=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <welcome-file>index.jsp<=
/welcome-file>=0A=C2=A0=C2=A0=C2=A0 </welcome-file-list>=0A=C2=A0=C2=A0=C2=
=A0 <resource-ref>=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <descriptio=
n>=0A=C2=A0=C2=A0=C2=A0 Resource reference to a factory for java.sql.Connec=
tion=0A=C2=A0=C2=A0=C2=A0 instances that may be used for talking to a parti=
cular=0A=C2=A0=C2=A0=C2=A0 database that is configured in the Context=0A=C2=
=A0=C2=A0=C2=A0=0A configurartion for the web application.=0A=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </description>=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0 <res-ref-name>=0A=C2=A0=C2=A0=C2=A0 jdbc/myDB=0A=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </res-ref-name>=0A=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 <res-type>=0A=C2=A0=C2=A0=C2=A0 javax.sql.DataSource=
=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </res-type>=0A=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 <res-auth>=0A=C2=A0=C2=A0=C2=A0 Container=0A=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </res-auth>=0A=C2=A0=C2=A0=C2=A0 </=
resource-ref>=0A</web-app>=0A</CODE>=0A=0AI have modified the XML file (MET=
A-INF/context.xml) found in the project=E2=80=99s folders=0A<CODE>=0A<?xml =
version=3D"1.0" encoding=3D"UTF-8"?>=0A<Context crossContext=3D"true" debug=
=3D"5" docBase=3D"TweetCollector" antiJARLocking=3D"true" path=3D"/TweetCol=
lector"=0A reloadable=3D"true">=C2=A0 =0A=C2=A0=C2=A0=C2=A0 <Resource name=
=3D"jdbc/myDB"=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 auth=3D"Container"=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 type=3D"javax.sql.DataSource"=0A=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 username=3D"root"=0A=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 password=3D"ad=
ministrator"=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0 driverClassName=3D"com.mysql.jdbc.Driver"=0A=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 url=3D"jdbc:mysql://localhost:33=
06/myDB?autoReconnect=3Dtrue"=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 maxActive=3D"8"=0A=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 maxIdle=3D"4"/>=0A</Context>=0A</CODE>=
=0A=0AI have modified the code in the java class for the database=0A connec=
tion=0A<CODE>=0AContext initCtx =3D new InitialContext();=0AContext envCtx =
=3D (Context) initCtx.lookup("java:comp/env");=0ADataSource ds =3D (DataSou=
rce)=0A=C2=A0 envCtx.lookup("jdbc/myDB");=0A=0AsetConnectionDB(ds.getConnec=
tion());=0A</CODE>=0A=0AI=0A read the steps at =0Ahttp://tomcat.apache.org/=
tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources.=0A I have also =
tried modifying the server.xml file. =0A=0AThe connection in the log prints=
 as=0Ajdbc:mysql://localhost:3306/myDB?autoReconnect=3Dtrue, UserName=3Droo=
t@localhost, MySQL-AB JDBC Driver=0A=0AHowever, it gives the error:=0Aorg.a=
pache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver=0AOR=
=0Ajava.sql.SQLException: No suitable driver=0A=0AIs=0A it that the version=
 for the server needs to match specific version for =0AMySQL and its driver=
? How can I solve the JDBC issue? I have tried so =0Amany posts and made so=
 many changes that i am really frustrated and dont=0A know=0A what else to =
do. Thanks.=0A=0ACheers
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message