[jboss-user] [JNDI/Naming/Network] - Re: Converting code from BEA WebLogic to JBoss

jaikiran do-not-reply at jboss.com
Wed Feb 7 17:20:22 EST 2007


anonymous wrote : 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.



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4012685#4012685

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4012685



More information about the jboss-user mailing list