You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "thevenin.olivier@laposte.net" <th...@laposte.net> on 2002/10/07 18:39:48 UTC

Pb with WarpConnector, JNDI, DBCP

Hello,
I am currently developping a web application on tomcat 4.1.12
under linux, with sun sdk 1.4.01.

I am using the JNDI resources together with jdbc pool from jakarta
(commons dbcp).

My web.xml file references my jdbc ressources, which are defined in my server.xml file, in the Context element of my application.

When my application is deployed under the default service, everything works fine. I get a connection from the pool when requesting a data source from my jndi context.

I want to deploy this application under an Apache 1.3 server running on the same host. For this, i use a WARP connector (together with mod_webapp), as the example at the end of the server.xml. The connection between apache and tomcat works perfectly (i can see my files).

But, i can no more have access to JNDI resources (hence no connection to my database). I tried multiple ways to perform this, putting the declaration of the pool in the Context element of the application deployed under WARP connector, or putting it in the GlobalNamingResources. No matter how i try, the connection pool pretends not to know the class for my jdbc driver.

This is the exception and the beginning of the stack trace:
Cannot load JDBC driver class 'null' (class java.sql.SQLException: Cannot load JDBC driver class 'null')
BasicDataSource.java: 529 => org.apache.commons.dbcp.BasicDataSource.createDataSource
BasicDataSource.java: 312 => org.apache.commons.dbcp.BasicDataSource.getConnection

And then here comes the place where i claim for a jdbc connection:
Context initCtx = new InitialContext() ;
Context envCtx = (Context) initCtx.lookup("java:comp/env") ;
ds = (DataSource) envCtx.lookup("jdbc/TEST") ;
// The exception is raised by this call (ds.getConnection())
// to the BasicDataSource.java: 312
Connection connection = ds.getConnection() ;

Does the jndi or common dbcp have problems with WARP connector ?

I join with this mail my server.xml as an attachment. I changed the names (database, user, pwd), but the principle is here. The file is correct on my server (in case i introduce a xml error while changing names). I tried multiple version of this file, declaring only a standalone context (service on port 8080), only one context for apache (using warp connector), or both, like in the file i join.

Please, can someone help me with this problem. I am struggling with this, and my application should work as soon as possible.

Olivier

Accédez au courrier électronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,13 €/mn) ; tél : 08 92 68 13 50 (0,34€/mn)"


Re: Pb with WarpConnector, JNDI, DBCP

Posted by Nikola Milutinovic <Ni...@ev.co.yu>.
John Walstra wrote:

> I used to use the WarpConnector. I just switched to mod_jk. When I used the 
> WarpConnector, I could not get the JNDI DataSource to work. I received the 
> same error you received. If I accessed my webapp using the 
> "Tomcat-Standalone" service it would work, but would not work via 
> "Tomcat-Apache" I'm not sure why this happens, but mod_jk is the least 
> painfully course of action.

If I recall correctly, someone identified a problem with WARP, something to do 
with paths used to deploy context. Search the archives.

Nix.


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Pb with WarpConnector, JNDI, DBCP

Posted by John Walstra <jw...@spoonserver.com>.
I used to use the WarpConnector. I just switched to mod_jk. When I used the 
WarpConnector, I could not get the JNDI DataSource to work. I received the 
same error you received. If I accessed my webapp using the 
"Tomcat-Standalone" service it would work, but would not work via 
"Tomcat-Apache" I'm not sure why this happens, but mod_jk is the least 
painfully course of action.

On Monday 07 October 2002 11:39 am, thevenin.olivier@laposte.net wrote:
> Hello,
> I am currently developping a web application on tomcat 4.1.12
> under linux, with sun sdk 1.4.01.
>
> I am using the JNDI resources together with jdbc pool from jakarta
> (commons dbcp).
>
> My web.xml file references my jdbc ressources, which are defined in my
> server.xml file, in the Context element of my application.
>
> When my application is deployed under the default service, everything works
> fine. I get a connection from the pool when requesting a data source from
> my jndi context.
>
> I want to deploy this application under an Apache 1.3 server running on the
> same host. For this, i use a WARP connector (together with mod_webapp), as
> the example at the end of the server.xml. The connection between apache and
> tomcat works perfectly (i can see my files).
>
> But, i can no more have access to JNDI resources (hence no connection to my
> database). I tried multiple ways to perform this, putting the declaration
> of the pool in the Context element of the application deployed under WARP
> connector, or putting it in the GlobalNamingResources. No matter how i try,
> the connection pool pretends not to know the class for my jdbc driver.
>
> This is the exception and the beginning of the stack trace:
> Cannot load JDBC driver class 'null' (class java.sql.SQLException: Cannot
> load JDBC driver class 'null') BasicDataSource.java: 529 =>
> org.apache.commons.dbcp.BasicDataSource.createDataSource
> BasicDataSource.java: 312 =>
> org.apache.commons.dbcp.BasicDataSource.getConnection
>
> And then here comes the place where i claim for a jdbc connection:
> Context initCtx = new InitialContext() ;
> Context envCtx = (Context) initCtx.lookup("java:comp/env") ;
> ds = (DataSource) envCtx.lookup("jdbc/TEST") ;
> // The exception is raised by this call (ds.getConnection())
> // to the BasicDataSource.java: 312
> Connection connection = ds.getConnection() ;
>
> Does the jndi or common dbcp have problems with WARP connector ?
>
> I join with this mail my server.xml as an attachment. I changed the names
> (database, user, pwd), but the principle is here. The file is correct on my
> server (in case i introduce a xml error while changing names). I tried
> multiple version of this file, declaring only a standalone context (service
> on port 8080), only one context for apache (using warp connector), or both,
> like in the file i join.
>
> Please, can someone help me with this problem. I am struggling with this,
> and my application should work as soon as possible.
>
> Olivier
>
> Accédez au courrier électronique de La Poste : www.laposte.net ; 3615
> LAPOSTENET (0,13 €/mn) ; tél : 08 92 68 13 50 (0,34€/mn)"

-- 
John Walstra
1002 North Stanford Street
Port Washington, WI 53074
H: (262) 284-2395
C: (847) 858-2395

jwalstra@spoonserver.com
john_walstra@yahoo.com
jwalstra@wi.rr.com

You like to form new friendships and make new acquaintances.

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>