tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luca Zago" <>
Subject Problems with JNDI GlobalNamingResources: access outside webapp
Date Thu, 26 Sep 2002 13:11:15 GMT
I have some problems with a JNDI look up.
I have my classes to in a web app, but in a jar in tomact common/lib, I 
put my jndi resourse in the GlobalNamingResources in the server.xml and 
I use this code to access the context.

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
ds = (DataSource)envCtx.lookup(datasource);

I got the error:
initialization failed : Name comp is not bound in this Context

it doesn't find the context..because it's out of a webapp..
Does somebody  know how to call the global context from the code?
is it possible to get access to the context outside a webapp?


Luca Zago
Senior IT Developer

E-TREE S.p.a.  Via Fonderia 43 - 31100 Treviso (Italy)
phone +39.0422.3107
fax   +39.0422.310888

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

View raw message