You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Josh G <jo...@gfunk007.com> on 2003/10/03 03:53:37 UTC
JNDI+dbcp Can't find my jdbc driver
Hi, I switched to jndi+dbcp for my database connection, and now it can't
find the driver. It seems like this is a common problem on the list, but
if an answer's been posted I can't find it. Any pointers much appreciated!
Cheers,
-Josh
--
[ Josh 'G' McDonald ][ 0415 784 825 ][ http://www.gfunk007.com/ ]
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Peter Harrison <pe...@nothingbutnet.co.nz>.
On Mon, 06 Oct 2003 14:55, Josh G wrote:
> Unfortunately it's already in a specific context as far as I can tell :(
> I've downloaded the source to dbcp and it seems it's throwing a
> SQLException on DriverManager.getDriver(url) but there's no reason I can
> see that it should, as the url it returns worked just fine when we were
> doing it the old fashioned way, the only difference is we called
> getConnection instead of calling getdriver and doing things seperately
> like dbcp does. Anybody know why getDriver would throw a SQLException
> where getConnection would not?
There are a few other issues as well. There is a new and old way of doing the
connection parameters. The old way had a parameter called 'user' - which has
been changed to 'username' - and 'url' replaced 'Driver'. If you are using
DBCP then you need to use 'username' and 'url'.
Below is an example that I use myself (with some changes to protect the
innocent):
<DefaultContext debug="0" reloadabe="true">
<Resource name="jdbc/foo"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/foo">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<parameter>
<name>validationQuery</name>
<value>SELECT 1;</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>500</value>
</parameter>
<parameter>
<name>username</name>
<value>bill</value>
</parameter>
<parameter>
<name>password</name>
<value>zap</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.postgresql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:postgresql://localhost/foo</value>
</parameter>
</ResourceParams>
</DefaultContext>
> This is really starting to get ridiculous, I've spent way too long
> trying to make this work, and I'm pulling my hair out so to speak.
I know how you feel. Trying to get this working under 4.1.27 was impossible
due to the afforementioned bug - so I'm still on 4.0.4. I spent two or three
days trying everything. Wish I had time to get in and debug it -
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
and this is mine (guaranteed to work! well, maybe... ;) ) It's in my
context for the particular app.
Did somebody say removeAbandoned was depracated?
<Resource name="jdbc/LinkLibDB"
auth="Container"
type="javax.sql.DataSource">
</Resource>
<ResourceParams name="jdbc/LinkLibDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- MySQL dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>xxxxx</value>
</parameter>
<parameter>
<name>password</name>
<value>xxxx</value>
</parameter>
<!-- Class name for mysql JDBC driver -->
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<!-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mysql JDBC Driver will automatically reconnect if mysqld closed the
connection. mysqld by default closes idle connections after 8 hours. -->
<parameter>
<name>url</name>
<value>jdbc:mysql://localhost:3306/linklibrary2</value>
</parameter>
<parameter>
<name>autoReconnect</name>
<value>true</value>
</parameter>
<parameter>
<name>useUnicode</name>
<value>true</value>
</parameter>
<parameter>
<name>characterEncoding</name>
<value>UTF-8</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit. -->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit. -->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely. -->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- abandoned dB connections are removed and recycled -->
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<!-- set the number of seconds a dB connection has been idle before
it is considered abandoned. default timeout is 300 seconds.-->
<parameter>
<name>removeAbandonedTimeout</name>
<value>60</value>
</parameter>
<!-- 'logAbandoned' can be set to true if you want DBCP to log a
stack trace of the code which abandoned connections.-->
<parameter>
<name>logAbandoned</name>
<value>true</value>
</parameter>
</ResourceParams>
On 10/06/2003 03:55 AM Josh G wrote:
> Peter Harrison wrote:
>
>> A known issue was with putting the resources under either the default
>> context or the global resources. If you do thins you end up with
>> various errors. This might not be the same issue of course. To fix it
>> place the resources in a Context you intend to run under.
>>
>>
> Unfortunately it's already in a specific context as far as I can tell :(
> I've downloaded the source to dbcp and it seems it's throwing a
> SQLException on DriverManager.getDriver(url) but there's no reason I can
> see that it should, as the url it returns worked just fine when we were
> doing it the old fashioned way, the only difference is we called
> getConnection instead of calling getdriver and doing things seperately
> like dbcp does. Anybody know why getDriver would throw a SQLException
> where getConnection would not?
>
> This is really starting to get ridiculous, I've spent way too long
> trying to make this work, and I'm pulling my hair out so to speak.
>
> Cheers,
> -Josh
>
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Josh G <jo...@gfunk007.com>.
Peter Harrison wrote:
>A known issue was with putting the resources under either the default context
>or the global resources. If you do thins you end up with various errors. This
>might not be the same issue of course. To fix it place the resources in a
>Context you intend to run under.
>
>
Unfortunately it's already in a specific context as far as I can tell :(
I've downloaded the source to dbcp and it seems it's throwing a
SQLException on DriverManager.getDriver(url) but there's no reason I can
see that it should, as the url it returns worked just fine when we were
doing it the old fashioned way, the only difference is we called
getConnection instead of calling getdriver and doing things seperately
like dbcp does. Anybody know why getDriver would throw a SQLException
where getConnection would not?
This is really starting to get ridiculous, I've spent way too long
trying to make this work, and I'm pulling my hair out so to speak.
Cheers,
-Josh
--
[ Josh 'G' McDonald ][ 0415 784 825 ][ http://www.gfunk007.com/ ]
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Peter Harrison <pe...@nothingbutnet.co.nz>.
On Mon, 06 Oct 2003 13:51, Josh G wrote:
> Tried that, still nothing. And there's nothing showing up in
> var/mysql.log either. Is there any way to dig up where exactly the
> problem is between tomcat and mysql?
A known issue was with putting the resources under either the default context
or the global resources. If you do thins you end up with various errors. This
might not be the same issue of course. To fix it place the resources in a
Context you intend to run under.
Regards,
Peter
PS : Anyone have success at posting bugz on bugzilla for Tomcat. I reported
this bug in detail, but can't seem to find it - as if its been delt with -
but I can't find it.
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Josh G <jo...@gfunk007.com>.
Adam Hardy wrote:
> Josh,
> try
>
> jdbc:mysql://localhost:3306/docomatic
>
Tried that, still nothing. And there's nothing showing up in
var/mysql.log either. Is there any way to dig up where exactly the
problem is between tomcat and mysql?
Cheers,
-Josh
--
[ Josh 'G' McDonald ][ 0415 784 825 ][ http://www.gfunk007.com/ ]
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
webapp/path
Posted by Roland Carlsson <ma...@javalia.se>.
Hi!
In my struts-config.xml i have the following in an action:
<forward
name="error"
path="/mywebapp/jsp/error.jsp"/>
Is there any way of telling struts to use the webapp-root instead of the
server-root so that I don't have to tell the name of the web-app... a
deployer might wanna deploy several instances of the web-app with different
names.
Thanks in advance
Roland Carlsson
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Josh,
try
jdbc:mysql://localhost:3306/docomatic
On 10/03/2003 04:34 AM Josh G wrote:
> Filip Hanik wrote:
>
>> put it in the same place as your DBCP jar files are
>>
> Ok done that, now I'm getting a new error that I can't find an
> explanation of on google :(
>
> java.sql.SQLException: Cannot create JDBC driver of class
> 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql:localhost/docomatic'
>
> What's this exception actually mean?
>
> -Josh
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Josh G <jo...@gfunk007.com>.
Filip Hanik wrote:
>put it in the same place as your DBCP jar files are
>
>
Ok done that, now I'm getting a new error that I can't find an
explanation of on google :(
java.sql.SQLException: Cannot create JDBC driver of class
'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql:localhost/docomatic'
What's this exception actually mean?
-Josh
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Filip Hanik <de...@hanik.com>.
put it in the same place as your DBCP jar files are
----- Original Message -----
From: "Josh G" <jo...@gfunk007.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Thursday, October 02, 2003 7:03 PM
Subject: Re: JNDI+dbcp Can't find my jdbc driver
Filip Hanik wrote:
>where are your driver classes located? common/lib?
>
>Filip
>
>
They're in shared/lib - should I add a symlink / copy it to common/lib?
--
[ Josh 'G' McDonald ][ 0415 784 825 ][ http://www.gfunk007.com/ ]
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Josh G <jo...@gfunk007.com>.
Filip Hanik wrote:
>where are your driver classes located? common/lib?
>
>Filip
>
>
They're in shared/lib - should I add a symlink / copy it to common/lib?
--
[ Josh 'G' McDonald ][ 0415 784 825 ][ http://www.gfunk007.com/ ]
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JNDI+dbcp Can't find my jdbc driver
Posted by Filip Hanik <de...@hanik.com>.
where are your driver classes located? common/lib?
Filip
----- Original Message -----
From: "Josh G" <jo...@gfunk007.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, October 02, 2003 6:53 PM
Subject: JNDI+dbcp Can't find my jdbc driver
Hi, I switched to jndi+dbcp for my database connection, and now it can't
find the driver. It seems like this is a common problem on the list, but
if an answer's been posted I can't find it. Any pointers much appreciated!
Cheers,
-Josh
--
[ Josh 'G' McDonald ][ 0415 784 825 ][ http://www.gfunk007.com/ ]
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org