permaculture playing cards
The moose likes EJB and other Java EE Technologies and the fly likes value for Context.PROVIDER_URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "value for Context.PROVIDER_URL" Watch "value for Context.PROVIDER_URL" New topic

value for Context.PROVIDER_URL

ved gunjan
Ranch Hand

Joined: May 17, 2003
Posts: 86
Hi! All
Here's my case.Im having hierrarical databse,wherein im storing file on the local hard disk.Im using WebSphere Application Server 5.0.I want to look up for a file object through JNDI and delivers it the JMS topic.
Can any one plz tell me what value should i provide to the Context.PROVIDER_URL environment variable?
The file is stored as follows c:\prototype\work_dir\myfile.xml
Also wht is the significance of java:comp/env when we do a look up?
In the present case what value should i give to lookup().....i mean sumthing like lookup("java:comp/env/URL/c:/prototype/work_dir/binded_name")???

Any help will be hihgly appreciated.

Many Regards
Ved Gunjan
Lalita Sattavat

Joined: May 31, 2004
Posts: 10
there are two things that u are trying to find as per my understanding
2. how-to lookup:

now both of these should be configurable and should not be hardcoded in the application so that tomorrow if u change the url/lookup location of ur file u do not have to re-compile ur code.

both the things can be done using environment entries. These entries are to be provided in the web.xml for the web application.
eg. add the following in your web.xml after taglib entries(if u have any)



And now read these values as
Context context=new InitialContext();
Strinf fl = (String) context.lookup("java:comp/env/file_location");
String url= (String) context.lookup("java:comp/env/Provider_url");

Note: PROVIDER_URL -> Its the location where your JNDI service is running. In case of weblogic the service runs on the same port where the server is started. In case of other app servers find out where the t3 service is running and the value for provider url should be accordingly set.

Let me know ur concerns if any
I agree. Here's the link:
subject: value for Context.PROVIDER_URL
It's not a secret anymore!