This content has been marked as final.
Show 1 reply
-
1. Re: Using jndi.properties file instead of hard coding
mipe Aug 29, 2002 12:26 PM (in response to nkm1)I load jndi.properties manually like this:
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Properties props = new Properties();
props.load(cl.getResourceAsStream(resname));
InitialContext initial = new InitialContext(props);
however, of course, it is also repetiative.
You may place this code in a common class that all other classes can reach such as the ServiceLocator class in the j2ee petstore demo (java.sun.com).