You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Steve Kirk <to...@web-startup.co.uk> on 2005/05/20 17:12:27 UTC

DBCP datasource works on 5.0.28 but fails on 5.5.9

I know that DBCP is a common problem discussed on this list - I have been
helped, and have helped other people, with it before. So before posting this
message, I have recently re-read the 5.5 release notes and 5.0/5.5 DBCP/JNDI
how-to docs and checked the list archives.  But can't find a solution to my
current problem.

Until recently I had a working webapp running on tomcat 5.0.28 with
connector/j 3.1.7 and mysql 4.1.11-nt, all on windows XP and jdk1.4.2_08.
The app uses container-managed commons DBCP for all its database access.

The DBCP resource config has been set up and working unchanged for a long
time on various builds of TC 5.0.  I have it set up like this:

<ResourceParams> defined in context.xml, in war file's META-INF folder
<resource-ref> declared in web.xml in war file's WEB-INF folder
The connector/j jar file is in tomcat's /common/lib folder
name of JNDI resource matches in <ResourceParams>, <resource-ref> and Java
source code.

This all works on TC5.0.28 / JDK1.4.2_08.  However, I am attempting to
upgrade to TC 5.5.9 / JDK1.5.0_02.  I did a fresh install of both of these
to standard directories, recompiled the webapp for jdk1.5, and deployed it
with the same config files and setup above from TC 5.0.28. However the
webapp now reports an error when requesting a connection from the pool, see
stacktrace below (from the TC stdout logfile under TC logs directory).

I tried changing my context.xml so that the params are all pairs of
name="value" within a single <Resource/> tag, as now seems to be preferred
in the 5.5 DBCP how-to, rather than my original nested set of tags under
<ResourceParams>, which was the approach used in the 5.0 equivalent how-to.
But still no joy.

I also tried upgrading to connector/j 3.1.8, no joy there either.

When TC starts up, the webapp deploys OK from its war file, and the
context.xml is copied to the /conf/[engine]/[host]/ folder OK, without any
parsing errors logged.  The connection pool initially seems to work, in the
sense that this code executes OK: 
	Context ctx = new InitialContext();
	String resourceString = "java:comp/env/jdbc/" +
config.getString(ConfigConstants.JNDI_DATABASE_RESOURCE_NAME);
	DataSource pool = (DataSource)ctx.lookup(resourceString);

However, an Exception is thrown the first time that I do this: 
	Connection conn = pool.getConnection();

I'm stumped after hours working on this.  I've read through all the docs,
how-tos, and release notes that I can find, and searched the mail list
archives on mysql and tomcat sites, as well as googling various searches.
Has anyone had this problem themselves or have any insight to offer please?

Thanks,

Steve.
-----------------------------------------------------------------
Exception caught when establishing/testing database pool****
cause[0]: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
driver of class '' for connect URL 'null'
 at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:780)
 at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:540)
 at core.sql.SqlQuery.prepare(SqlQuery.java:80)
 at core.sql.SqlQuery.executeSingleValue(SqlQuery.java:133)
 at core.servlet.Invoker.setUpDataSource(Invoker.java:325)
 at core.servlet.Invoker.init(Invoker.java:129)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:10
91)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3857)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
59)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
 at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)
 at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
 at org.apache.catalina.core.StandardService.start(StandardService.java:450)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
 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.start(Bootstrap.java:271)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
cause[1]: java.sql.SQLException: No suitable driver
 at java.sql.DriverManager.getDriver(DriverManager.java:243)
 at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource
.java:773)
 at
org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.ja
va:540)
 at core.sql.SqlQuery.prepare(SqlQuery.java:80)
 at core.sql.SqlQuery.executeSingleValue(SqlQuery.java:133)
 at core.servlet.Invoker.setUpDataSource(Invoker.java:325)
 at core.servlet.Invoker.init(Invoker.java:129)
 at
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:10
91)
 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
 at
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:
3857)
 at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
 at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
59)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
 at
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)
 at
org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536
)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
 at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:119)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
 at org.apache.catalina.core.StandardService.start(StandardService.java:450)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
 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.start(Bootstrap.java:271)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Steve Kirk <to...@web-startup.co.uk>.
Thanks lutz, that's in fact exactly how I now have it.  I have also deleted
the webapp (and the context xml file under /conf) and recompiled/restarted,
to make sure the new context config is loaded, but still no joy.

> -----Original Message-----
> From: Lutz Zetzsche [mailto:Lutz.Zetzsche@sea-rescue.de] 
> Sent: Friday 20 May 2005 16:59
> To: Tomcat Users List
> Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
> 
> 
> Hi,
> 
> Am Freitag, 20. Mai 2005 17:22 schrieb Nikola Milutinovic:
> > Steve Kirk wrote:
> > This most commonly means that the definition of the DataSource
> > resource lacks driver definition. Could it be that you've missed the
> > fact that DataSource JNDI resource setup definition has 
> changed in TC
> > 5.5? It is no longer with those
> > <parameter><name>...</name><value>...</value></parameter>. Check it
> > out.
> 
> This is exactly what I would guess, too. From Tomcat 5.0 to 5.5, the 
> Resource element syntax has changed. It is now like:
> 
> <Resource
>                         name="..."
>                         auth="Container"
>                         type="javax.sql.DataSource"
>                         driverClassName="..."
>                         url="jdbc:..."
>                         username="..."
>                         password="..."
>                         maxActive="20"
>                         maxIdle="10"
>                         maxWait="-1"
> 
>                         removeAbandoned="true"
>                         removeAbandonedTimeout="300"
>                         logAbandoned="true" />
> 
> 
> Best wishes
> 
> Lutz



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Lutz Zetzsche <Lu...@sea-rescue.de>.
Hi,

Am Freitag, 20. Mai 2005 17:22 schrieb Nikola Milutinovic:
> Steve Kirk wrote:
> This most commonly means that the definition of the DataSource
> resource lacks driver definition. Could it be that you've missed the
> fact that DataSource JNDI resource setup definition has changed in TC
> 5.5? It is no longer with those
> <parameter><name>...</name><value>...</value></parameter>. Check it
> out.

This is exactly what I would guess, too. From Tomcat 5.0 to 5.5, the 
Resource element syntax has changed. It is now like:

<Resource
                        name="..."
                        auth="Container"
                        type="javax.sql.DataSource"
                        driverClassName="..."
                        url="jdbc:..."
                        username="..."
                        password="..."
                        maxActive="20"
                        maxIdle="10"
                        maxWait="-1"

                        removeAbandoned="true"
                        removeAbandonedTimeout="300"
                        logAbandoned="true" />


Best wishes

Lutz

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Lutz Zetzsche <Lu...@sea-rescue.de>.
Hi Steve,

Am Montag, 23. Mai 2005 00:39 schrieb Steve Kirk:
> I started replying to yr post including my full config, had nearly
> finished, then saw the problem - I had a leading space in the 'url'
> value within the <Resource> tag of my context.xml file.  Grrr!  I

[...]

> Thanks very much to both of you for your patient help.  Without your
> prompting, I was ready to start first thing Monday by writing off 3
> days' upgrade effort by rolling back to 5.0.28, but now tomorrow is
> now looking like being productive :)

Great. :-) So, your new favourite song is "I like Mondays!". ;-)

It would have been annoying to downgrade back, having lost all the time 
and knowing that you have to upgrade sometime again nevertheless. Typing 
errors are the worst errors to find as everything seems to be right, 
but what is thought to be right doesn't work.

So you can now finally have joy. :-)))


Best wishes

Lutz

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Steve Kirk <to...@web-startup.co.uk>.
Lutz,

I started replying to yr post including my full config, had nearly finished,
then saw the problem - I had a leading space in the 'url' value within the
<Resource> tag of my context.xml file.  Grrr!  I must have included it by
accident when converting from the nested
<ResourceParams><parameter></parameter></ResourceParams> approach used in
TC5.0 to the single <Resource/> tag approach favoured in TC5.5.

So basically Nix was right in his first post...

Thanks very much to both of you for your patient help.  Without your
prompting, I was ready to start first thing Monday by writing off 3 days'
upgrade effort by rolling back to 5.0.28, but now tomorrow is now looking
like being productive :)

> -----Original Message-----
> From: Lutz Zetzsche [mailto:Lutz.Zetzsche@sea-rescue.de] 
> Sent: Sunday 22 May 2005 22:42
> To: Tomcat Users List
> Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
> 
> 
> Hi Steve,
> 
> Am Sonntag, 22. Mai 2005 22:58 schrieb Steve Kirk:
> > Thanks again Nix, but latest mysql driver is *definitely* in
> > %catalina_home%\common\lib :
> 
> Did you check that the MySQL driver is only there and not 
> additionally 
> in a second directory, i.e. WEB-INF/lib, which could confuse Tomcat?
> 
> 
> > - mysql works from the command line using my datasource username/pw;
> 
> Are you really using the correct URL to connect to the database? Are 
> host name, port and database name ok? I.e. the database name is 
> case-sensitive (at least on Linux, check it on Windows)!
> 
> Are you running Tomcat with Security Manager? Then you may 
> have missed 
> to set the necessary security rules for connecting.
> 
> 
> > I'm almost tired of looking - if I can't solve it tomorrow, I'll be
> > (very reluctantly) setting aside TC 5.5 and carrying on 
> with 5.0.28. 
> > I don't want to do that, because 5.0.28 has some sesssion management
> > bugs I'd like to get past, and also because I've now spent 3 days
> > trying to make 5.5 work.
> 
> Perhaps you can post your exact configuration here, 
> anonymizing user and 
> password values. What did you configure where? I.e. where is the 
> context file in which you did the relevant entry? Etc.
> 
> 
> Bet wishes
> 
> Lutz
> 
> ---------------------------------------------------------------------
> 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: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Lutz Zetzsche <Lu...@sea-rescue.de>.
Hi Steve,

Am Sonntag, 22. Mai 2005 22:58 schrieb Steve Kirk:
> Thanks again Nix, but latest mysql driver is *definitely* in
> %catalina_home%\common\lib :

Did you check that the MySQL driver is only there and not additionally 
in a second directory, i.e. WEB-INF/lib, which could confuse Tomcat?


> - mysql works from the command line using my datasource username/pw;

Are you really using the correct URL to connect to the database? Are 
host name, port and database name ok? I.e. the database name is 
case-sensitive (at least on Linux, check it on Windows)!

Are you running Tomcat with Security Manager? Then you may have missed 
to set the necessary security rules for connecting.


> I'm almost tired of looking - if I can't solve it tomorrow, I'll be
> (very reluctantly) setting aside TC 5.5 and carrying on with 5.0.28. 
> I don't want to do that, because 5.0.28 has some sesssion management
> bugs I'd like to get past, and also because I've now spent 3 days
> trying to make 5.5 work.

Perhaps you can post your exact configuration here, anonymizing user and 
password values. What did you configure where? I.e. where is the 
context file in which you did the relevant entry? Etc.


Bet wishes

Lutz

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Steve Kirk <to...@web-startup.co.uk>.
Thanks again Nix, but latest mysql driver is *definitely* in
%catalina_home%\common\lib : 

C:\>dir %catalina_home%\common\lib
 Volume in drive C is BOOT
 Volume Serial Number is D4DF-165E

 Directory of c:\jakarta-tomcat-5.5.9\common\lib

19/05/2005  19:25    <DIR>          .
19/05/2005  19:25    <DIR>          ..
11/05/2004  12:54            54,829 activation.jar
26/03/2005  14:22           112,341 commons-el.jar
26/03/2005  14:22           918,743 jasper-compiler-jdt.jar
26/03/2005  14:22           383,134 jasper-compiler.jar
26/03/2005  14:22            76,664 jasper-runtime.jar
26/03/2005  14:22            50,493 jsp-api.jar
12/10/2004  13:20           347,137 mail.jar
14/04/2005  22:44           409,191 mysql-connector-java-3.1.8-bin.jar
26/03/2005  14:22           154,101 naming-factory-dbcp.jar
26/03/2005  14:22            36,333 naming-factory.jar
26/03/2005  14:22            46,606 naming-resources.jar
26/03/2005  14:22            97,693 servlet-api.jar
              12 File(s)      2,687,265 bytes
               2 Dir(s)   2,182,369,280 bytes free



OK, so now I'm struggling.

So I'm going to take a punt and say that I think there may be some kind of
class loading problem.  I say this because:

- I have fresh installed TC, mysql and jdk; 
- mysql works from the command line using my datasource username/pw; 
- I have checked and rechecked my config a thousand times; 
- the mysql driver is in the right folder; 
- the error is suggestive of the fact that TC can't find the driver.

However, the driver it is there in the common/lib folder, plain for anyone
to see.  I can only assume this is to do with security/classloading.  I've
eliminated security, because TC runs as a service under the system account,
and I've checked that this account has read access to the file.

I'm almost tired of looking - if I can't solve it tomorrow, I'll be (very
reluctantly) setting aside TC 5.5 and carrying on with 5.0.28.  I don't want
to do that, because 5.0.28 has some sesssion management bugs I'd like to get
past, and also because I've now spent 3 days trying to make 5.5 work.

So, any help would be most gratefully received :)

Original post here for those that missed it: 
http://marc.theaimsgroup.com/?l=tomcat-user&m=111660199623420&w=2  

> -----Original Message-----
> From: Nikola Milutinovic [mailto:Nikola.Milutinovic@ev.co.yu] 
> Sent: Saturday 21 May 2005 13:42
> To: Tomcat Users List
> Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
> 
> 
> Steve Kirk wrote:
> 
> >Thanks nix.
> >
> >  
> >
> >>Could it be that you've missed the fact that 
> >>DataSource JNDI resource setup definition has changed in TC 
> >>5.5? It is 
> >>no longer with those 
> >><parameter><name>...</name><value>...</value></parameter>. 
> >>    
> >>
> >
> >Yes I already changed that.  I used to use the approach you 
> mention in
> >5.0.28, i.e.:
> >
> >	<ResourceParams name="jdbc/myResource">
> >		<parameter>
> >			<name>username</name>
> >			<value>...</value>
> >		</parameter>
> >		<parameter>
> >			<name>password</name>
> >			<value>...</value>
> >		</parameter>
> >
> >		etc
> >
> >	</ResourceParams>
> >
> >But noticed that the new 5.5 DBCP example used this approach:
> >
> ><Resource username="...." password="..."  etc />
> >
> >So I switched to that, but still no joy.
> >
> >PS does it actually say in the docs anywhere that the
> ><parameter><name>...</name><value>...</value></parameter> 
> approach is *NOT*
> >valid in 5.5?  If so then I've missed some docs somewhere, 
> maybe there is
> >other new stuff that I haven't seen.
> >  
> >
> 
> It definitely does not work in 5.5. I've used the config from 
> the docs 
> page with PostgreSQL and it worked. Other possible problem is 
> that the 
> driver class didn't load. Where have you placed the JDBC JAR? It goes 
> either in ${CATALINA_HOME}/common/lib since it must be 
> accessable to TC.
> 
> Nix.
> 
> ---------------------------------------------------------------------
> 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: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
Steve Kirk wrote:

>Thanks nix.
>
>  
>
>>Could it be that you've missed the fact that 
>>DataSource JNDI resource setup definition has changed in TC 
>>5.5? It is 
>>no longer with those 
>><parameter><name>...</name><value>...</value></parameter>. 
>>    
>>
>
>Yes I already changed that.  I used to use the approach you mention in
>5.0.28, i.e.:
>
>	<ResourceParams name="jdbc/myResource">
>		<parameter>
>			<name>username</name>
>			<value>...</value>
>		</parameter>
>		<parameter>
>			<name>password</name>
>			<value>...</value>
>		</parameter>
>
>		etc
>
>	</ResourceParams>
>
>But noticed that the new 5.5 DBCP example used this approach:
>
><Resource username="...." password="..."  etc />
>
>So I switched to that, but still no joy.
>
>PS does it actually say in the docs anywhere that the
><parameter><name>...</name><value>...</value></parameter> approach is *NOT*
>valid in 5.5?  If so then I've missed some docs somewhere, maybe there is
>other new stuff that I haven't seen.
>  
>

It definitely does not work in 5.5. I've used the config from the docs 
page with PostgreSQL and it worked. Other possible problem is that the 
driver class didn't load. Where have you placed the JDBC JAR? It goes 
either in ${CATALINA_HOME}/common/lib since it must be accessable to TC.

Nix.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Steve Kirk <to...@web-startup.co.uk>.
Thanks nix.

> Could it be that you've missed the fact that 
> DataSource JNDI resource setup definition has changed in TC 
> 5.5? It is 
> no longer with those 
> <parameter><name>...</name><value>...</value></parameter>. 

Yes I already changed that.  I used to use the approach you mention in
5.0.28, i.e.:

	<ResourceParams name="jdbc/myResource">
		<parameter>
			<name>username</name>
			<value>...</value>
		</parameter>
		<parameter>
			<name>password</name>
			<value>...</value>
		</parameter>

		etc

	</ResourceParams>

But noticed that the new 5.5 DBCP example used this approach:

<Resource username="...." password="..."  etc />

So I switched to that, but still no joy.

PS does it actually say in the docs anywhere that the
<parameter><name>...</name><value>...</value></parameter> approach is *NOT*
valid in 5.5?  If so then I've missed some docs somewhere, maybe there is
other new stuff that I haven't seen.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: DBCP datasource works on 5.0.28 but fails on 5.5.9

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
Steve Kirk wrote:

>When TC starts up, the webapp deploys OK from its war file, and the
>context.xml is copied to the /conf/[engine]/[host]/ folder OK, without any
>parsing errors logged.  The connection pool initially seems to work, in the
>sense that this code executes OK: 
>	Context ctx = new InitialContext();
>	String resourceString = "java:comp/env/jdbc/" +
>config.getString(ConfigConstants.JNDI_DATABASE_RESOURCE_NAME);
>	DataSource pool = (DataSource)ctx.lookup(resourceString);
>
>However, an Exception is thrown the first time that I do this: 
>	Connection conn = pool.getConnection();
>  
>

This doens't mean much. You will get a DBCP object event if connection 
data is wrong. It will however fail on attempting to obtain a 
connection. In my oppinion it would be nice if it failed during web app 
deployment, thus not leading us to believe all is OK. Although it would 
be yet another source of frustration. And I can see an argument that 
failing to correctly setup a DataSource should not invalidate the entire 
web app, since it could be setup with N DataSources and inteligence to 
choose one that works.

>-----------------------------------------------------------------
>Exception caught when establishing/testing database pool****
>cause[0]: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
>driver of class '' for connect URL 'null'
>  
>

This most commonly means that the definition of the DataSource resource 
lacks driver definition. Could it be that you've missed the fact that 
DataSource JNDI resource setup definition has changed in TC 5.5? It is 
no longer with those 
<parameter><name>...</name><value>...</value></parameter>. Check it out.

Nix.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org