You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Bateman <bo...@sequoiallc.com> on 2005/04/12 23:24:06 UTC
TC 5.5 and commons-dbcp
I'm in the process of moving an application that is in production today
on a TC 4.1.30 deployment over to 5.5.
So far, everything has moved without too much trouble. That is, until I
get to the use of commons-dbcp in the code. The code uses
BasicDataSource to interface to commons-dbcp.
Under 4.1.30 (and I believe 5.0 as well...) I can do:
Context ctx = new InitialContext();
BasicDataSource ds = (BasicDataSource)ctx.lookup("jndi string");
And I would get a data source. Under 5.5.7 and 5.5.9, ctx.lookup()
throws an Exception. BUT, neither getMessage() nor getCause() return
anything legit (both return NULL).
My setup requires me to run TC with -security. Using -verbose:class and
-Djava.security.debug=access,failure (THANKS Jon Wingfield!), I've
determined that TC 5.5.7 and 5.5.9 are loading everything and that I
have permission to access the various modules
[Opened /usr/java/Tomcat/common/endorsed/commons-dbcp-1.2.1.jar]
[Opened
/usr/java/Tomcat/common/endorsed/mysql-connector-java-3.0.12-production-bin.jar]
access: access allowed (java.io.FilePermission
/usr/java/Tomcat/common/endorsed/commons-dbcp-1.2.1.jar read)
access: access allowed (java.io.FilePermission
/usr/java/Tomcat/common/endorsed/mysql-connector-java-3.0.12-production-bin.jar read)
access: access allowed (java.io.FilePermission
/usr/java/Tomcat/common/lib/naming-factory-dbcp.jar read)
[Loaded org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
But I don't get anything legit out of ctx.lookup() :(
I'd like to see if I can debug this to isolate *where* things are going
a-stray... Can anyone set my on the correct path? A search of this
list hasn't revealed anything *other* than my JNDI string is incorrect
(I can deploy the same WAR to 4.1.30 and 5.0 and it works - so I suspect
my environment and possibly TC 5.5 and the -security setting...)
Thanks in advance!
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: TC 5.5 and commons-dbcp
Posted by "Trond G. Ziarkowski" <tr...@gep-as.com>.
Hi Robert,
the JNDI resource configuration has changed in 5.5. Check out the docs
for an example:
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html.
Also Tomcat 5.5 has changed the commons-dbcp-x.x.x.jar to
naming-factory-dbcp.jar. And the org.apache.commons.dbcp.BasicDataSource
is now moved to org.apache.tomcat.dbcp.dbcp.BasicDataSource.
Trond
Robert Bateman wrote:
>I'm in the process of moving an application that is in production today
>on a TC 4.1.30 deployment over to 5.5.
>
>So far, everything has moved without too much trouble. That is, until I
>get to the use of commons-dbcp in the code. The code uses
>BasicDataSource to interface to commons-dbcp.
>
>Under 4.1.30 (and I believe 5.0 as well...) I can do:
>
>Context ctx = new InitialContext();
>BasicDataSource ds = (BasicDataSource)ctx.lookup("jndi string");
>
>And I would get a data source. Under 5.5.7 and 5.5.9, ctx.lookup()
>throws an Exception. BUT, neither getMessage() nor getCause() return
>anything legit (both return NULL).
>
>
>My setup requires me to run TC with -security. Using -verbose:class and
>-Djava.security.debug=access,failure (THANKS Jon Wingfield!), I've
>determined that TC 5.5.7 and 5.5.9 are loading everything and that I
>have permission to access the various modules
>
>
>[Opened /usr/java/Tomcat/common/endorsed/commons-dbcp-1.2.1.jar]
>[Opened
>/usr/java/Tomcat/common/endorsed/mysql-connector-java-3.0.12-production-bin.jar]
>access: access allowed (java.io.FilePermission
>/usr/java/Tomcat/common/endorsed/commons-dbcp-1.2.1.jar read)
>access: access allowed (java.io.FilePermission
>/usr/java/Tomcat/common/endorsed/mysql-connector-java-3.0.12-production-bin.jar read)
>access: access allowed (java.io.FilePermission
>/usr/java/Tomcat/common/lib/naming-factory-dbcp.jar read)
>[Loaded org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
>
>
>But I don't get anything legit out of ctx.lookup() :(
>
>I'd like to see if I can debug this to isolate *where* things are going
>a-stray... Can anyone set my on the correct path? A search of this
>list hasn't revealed anything *other* than my JNDI string is incorrect
>(I can deploy the same WAR to 4.1.30 and 5.0 and it works - so I suspect
>my environment and possibly TC 5.5 and the -security setting...)
>
>
>Thanks in advance!
>
>
>Bob
>
>
>---------------------------------------------------------------------
>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