tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ps <>
Subject TC 3.2.x : How to get DataSource (Resource) defined on server.xml?
Date Wed, 05 Feb 2003 16:06:54 GMT

could anyone tell me if it's *POSSIBLE* in *TOMCAT 3.2.4* to define a
<resource> of a datasource in server.xml for DBCP, a <resource-ref> in
web.xml, and retrieve it on init() of a servlet using JNDI??

I'm trying to do it as I do with TOMCAT 4.1.x, but I'm getting this
exception related to JNDI:

javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file:  java.naming.factory.initial
        at javax.naming.InitialContext.lookup(

I'm doing this:

Context initCtx = new InitialContext();
this.ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/ngincaredb");

but probably I should initialize the context like this (not necessary on
TOMCAT 4.1.x):

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "????????");
Context initCtx = new InitialContext(env);

But, I have no clue what should I put in "??????" for use in tomcat

please, can anyone give me a hint or if it's possible or not?

Or should I have to initialize a DBCP on my code using some properties?

Pedro Salazar.

key id: 0E129E31D803BC61

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message