Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-12-2008, 05:57 PM
Member
 
Join Date: Mar 2008
Posts: 1
rinks is on a distinguished road
how to configure a JNDI URL resource
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure JavaDocs in Eclipse javaplus New To Java 3 11-26-2007 07:17 PM
Unable to configure JNDI properties amitid4forum Java Blogs 0 11-26-2007 04:37 PM
Configure J2 SDK1.3.1_20 on XP Neon Blue New To Java 3 08-13-2007 11:19 PM
error in JNDI naming jitendra.ibs Java Servlet 0 06-08-2007 06:23 PM
Velocity, cannot find resource sandor Web Frameworks 1 05-17-2007 11:58 PM


All times are GMT +3. The time now is 05:38 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org