This content has been marked as final.
Show 2 replies
-
1. Re: Converting code from BEA WebLogic to JBoss
jaikiran Feb 7, 2007 5:20 PM (in response to karuvelil)The following code snippet is from the servlet we developed (before creating the context)
-------------------------------------------------------------------------------------
if (props == null) {
props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "t3://10.10.10.12:7001");
}
-------------------------------------------------------------------------------------
Ideally these should have come from a properties file. Since you mention that this code belongs to a Servlet, you can just delete this part of code and use the default constructor of InitialContext. Something like:Context ctx = new InitialContext();
You dont have to pass the properties. JBoss will look into the classpath for a file named jndi.properties (which is by default shipped with JBoss with the appropriate entries) and use it while doing the lookup. -
2. Re: Converting code from BEA WebLogic to JBoss
jaikiran Feb 7, 2007 5:23 PM (in response to karuvelil)But if you still want to pass those properties through code, you can use:
if (props == null) {
props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
}