Hi Patrick,
shared/lib is quite ok - that is where mine resides and everything works
just fine... The content of myWebApp,xml is straight out of my one two and
my db connection works just fine. The question would be when and where you
actually get that error. Have you turned on logging for your webapp and
ensured that the jndi ressource is really there? There should be an entry
(depending on your logging level) like this there:
2004-06-30 14:59:06 NamingContextListener[/Catalina/localhost/myWebApp]:
Adding resource ref jdbc/myWebApp
2004-06-30 14:59:06 NamingContextListener[/Catalina/localhost/myWebApp]:
ResourceRef[className=javax.sql.DataSource,factoryClassLocation=null,factory
ClassName=org.apache.naming.factory.ResourceFactory,{type=scope,content=Shar
eable},{type=auth,content=Container},{type=url,content=jdbc:mysql://loalhost
:3306/myWebApp?autoReconnect=true},{type=maxIdle,content=15},{type=maxActive
,content=50},{type=driverClassName,content=com.mysql.jdbc.Driver},{type=maxW
ait,content=10000},{type=removeAbandoned,content=true},{type=username,conten
t=myWebApp},{type=factory,content=org.apache.commons.dbcp.BasicDataSourceFac
tory},{type=removeAbandonedTimeout,content=60},{type=password,content=secret
}]
If that does not help, add the following inside <web-app> of your web.xml
(should be in webapps WEB-INF dir).
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/myWebApp</res-ref-name> <!-- exchange myWebApp with
whatever you have named your datasource in the <context/> -->
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Best you then delete all contents of
{CATALINA_HOME}\work\localhost\myWebApp\ and restart Tomcat. Then check your
logs and see whether it finds and intializes the ressource.
HTH, Jan
-----Original Message-----
From: Briggs, Patrick [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 9:47 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat -> MySQL = No suitable driver ERROR
Ok, I have it in the common/lib directory, but that didn't make a
difference. You'd think there would be a lot easier way to setup stuff like
this. Editing XML files is pretty tricky business.
-----Original Message-----
From: David Smith [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 12:19 PM
To: Tomcat Users List
Subject: Re: Tomcat -> MySQL = No suitable driver ERROR
Wrong place for mysql jar file. It should be in
{TOMCAT_HOME}/common/lib right along side the DBCP jar file.
--David
Briggs, Patrick wrote:
If the webapps.xml file is supposed to be located in
Catalina\localhost,
the
apache's own website documentation JDBC-HOWTO needs to be updated to
reflect
that new situation. I'm surprised they haven't updated it because I'm
sure a lot of other people are going to be having the same problems I
am.
I have made all of the changes you have suggest. the mysql.jar file
has been deleted everywhere except for {CATALINA_HOME}/shared/lib where
I have now placed it.
I have created a file called DBTest.xml over in
/conf/Catalina/localhost/DBTest.xml
I used your template for the XML find changing it where it needs
changes
for
URL and username/password.
Still getting the same error message :(
So now what could it be?
-----Original Message-----
From: Jan Behrens [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 30, 2004 1:58 AM
To: 'Tomcat Users List'
Subject: RE: Tomcat -> MySQL = No suitable driver ERROR
Hi Patrick,
the problem might be that in Tomcat 5.x the storage of the context
related configuration changed from server.xml to a sepparate file for
each webapp. This file should be stored under
{Catalina_Home}\conf\Catalina\{domain-name}\myWebAppName.xml where
Catalina_Home points to your Tomcat installation dir and domain_name
usually
would be localhost in a dev-environment.
If you have a webapp called myWebApp and want to setup a datastore via
jndi for same to use in Tomcat 5 you could use the following as a basis
for a myWebApp.xml file stored under
{Catalina_Home}\conf\Catalina\{domain-name}\myWebAppName.xml:
<?xml version='1.0' encoding='utf-8'?>
<Context debug="5" displayName="myWebApp" docBase="myWebApp "
path="/myWebApp" reloadable="true"
workDir="work\Catalina\localhost\myWebApp">
<Resource auth="Container" name="jdbc/myWebApp"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/myWebApp">
<parameter>
<name>url</name>
<value>jdbc:mysql://NAME_OR_IP_OF_MYSQL_SERVER:3306/NAME_OF_DATABASE?au
toRe
c
onnect=true</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>15</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>50</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>username</name>
<value>USERNAME</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>
<parameter>
<name>password</name>
<value>PASSWORD</value>
</parameter>
</ResourceParams>
</Context>
The MySQL driver does have to go under {Catalina_Home}\shared\lib!
Delete any other copies you might have placed in your WEB-INF\lib or
anywhere
else.
You should also remove the <context>....</context> you inserted in
server.xml as this should all go in the myWebApp.xml file.
If you ever deploy your webapp you then only have to copy your
myWebApp.xml to the Manifest dir in your webapp root dir before
creating the war-file
and
Tomcat will automatically create the correct context for your webapp.
HTH, Jan
This e-mail message, including any attachments, is for the sole use of
the intended recipient(s) and may contain confidential or privileged
information. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy the message.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail message, including any attachments, is for the sole use of the
intended recipient(s) and may contain confidential or privileged
information. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy the message.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]