Hi Dirk,

Thanks again for responding. I have tried putting this into it's own context file. For my latest attempt, I have created the data source using the admin module, and it rewrote my server.xml file for me, so I'm assuming it's in there correctly. No matter how I do it ( and i really have followed the directions in the link you gave me), I can't seem to get it to work. I must be missing something, but I can't seem to find it.

Dirk Weigenand wrote:

Sean,

--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List <tomcat-user@jakarta.apache.org>
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk. I've practically memorized the documentation on the link you sent:

// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here's what I get (which led me to trying it the way
I posted):

javax.naming.NameNotFoundException: Name java:comp is not bound in this
Context


No. Did you look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html?

I recommend putting the context definition in its own content.xml. On
redeploying my application tomcat wouldn't find the driver class anymore.

Mind you not the class itself but the definition of what class to load.

This problem was solved by putting the context into context.xml.

regards
      Dirk


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to