This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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")???
there are two things that u are trying to find as per my understanding 1. PRIVIDER_URL: 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.