tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dirk Weigenand" <Dirk.Weigen...@gmx.de>
Subject Re: jndi question
Date Mon, 22 Aug 2005 15:44:22 GMT
Sean,

> --- Urspr√ľngliche Nachricht ---
> Von: Sean Rowe <ichabooka@gmail.com>
> 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

-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

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


Mime
View raw message