2 Replies Latest reply on Feb 7, 2007 5:23 PM by jaikiran pai

    Converting code from BEA WebLogic to JBoss

    Harikumar Nair Newbie

      We deployed a 3rd party application in our environment. We then developed & deployed a servlet which invoke an EJB method. Now we are moving away from BEA to JBoss.

      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");
      }
      -------------------------------------------------------------------------------------

      How can I change this to JBoss specific (especially the t3://)?

      Thanks in advance!

        • 1. Re: Converting code from BEA WebLogic to JBoss
          jaikiran pai Master

           

          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 pai Master

            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");
            }