I am trying to replicate the Websphere's URL Resource provider functionality in
Tomcat, but haven't been really successful. So what I would like to do is access a properties file from a URL. This provides a convenient approach to modifying prop files as apposed to residing within WAR file. Anyway back to my question, I have taken a stab at this and below is how my meta-inf\context.xml, web.xml, and jndi code snippet looks.
CONTEXT.XML
code:
--------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?><Context> <Resource name="url/wfresource" auth="Container" type="java.net.URL" url="http://localhost:8080/ibi_html/wfresource.properties"/></Context>
--------------------------------------------------------------------------------
WEB.XML
code:
--------------------------------------------------------------------------------
<resource-env-ref> <description>Object factory for MyBean instances.</description> <resource-env-ref-name>url/wfresource</resource-env-ref-name> <resource-env-ref-type>java.net.URL</resource-env-ref-type></resource-env-ref>
--------------------------------------------------------------------------------
JNDI Lookup code snippet
code:
--------------------------------------------------------------------------------
//Get a handle to the JNDI environment naming contextContext env = (Context)new InitialContext().lookup("java:comp/env");//Get a single valuejava.net.URL destURL = (java.net.URL)env.lookup("url/wfresource");
--------------------------------------------------------------------------------
Its throwing an exception.
My question is if URL resource configuration is possible in Tomcat 5.5, and if so how.
thanks