"Arthur van Dorp" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Hi all
>
> I've got webapps deployed in tomcat 5.5.x that use some resources defined 
> in
> their respective context.xml files. I'd like to use those resource in a 
> java
> program on the same machine (which isn't a webapp). Most resource
> descriptions would be easy enough to parse with a bit of xpath, but for
> general resource definitions I'd rather reuse the classes that parse those
> context files in tomcat or the J2SE. I'd imagine the code from my side to
> look something like this:
>
> Context ctx = SomeClass.SomeHowParseContext(somepath+"context.xml");
> Context env = (Context) ctx.lookup("java:comp/env");
> DataSource dataSource = (DataSource) env.lookup("jdbc/SOMEDB");
>
> I couldn't figure out from the tomcat source code where the context.xml
> loading part gets done and what classes I'd need to use. Any pointers
> welcome.
>

Well, it's pretty integrated into Tomcat, so it won't be pretty to strip out 
:).  The actual JNDI code is under the o.a.naming package (located under 
container/catalina/src/share in the source distro).  The code that parses 
'context.xml' is in o.a.c.startup.ContextConfig (located under the same 
path).

> Thanks, Arthur.
>
>
>
>
>
> -- 
> Mobile Internet - E-Mail und Internet immer und überall!
> GMX zum Mitnehmen: http://www.gmx.net/de/go/pocketweb 




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

Reply via email to