tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: Extract resource from context.xml from external app
Date Fri, 19 May 2006 03:55:21 GMT

"Arthur van Dorp" <arthur_vd@gmx.net> wrote in message 
news:1696.1147949766@www024.gmx.net...
> 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message