2 Replies Latest reply on Feb 9, 2009 4:58 PM by Prav Ford

    jndi lookup on a different app server (glassfish)

    Andy Fong Newbie

      Trying to do what I thought would be a easy task but search the web up and down and can't find a solution.

      I am try to access a remote ejb3 in glassfish(v2) from jboss (4.0.5).

      On a stand-alone app, it's easy, I just include the appserv-rt.jar and javaee.jar in my classpath and create an initialcontext and do the lookup. Works just fine.

      On jboss, it's different. I deleted all the *.properties file in the appserv-rt.jar so it won't interfere with jboss and rename it to xappserv-rt.jar and put it in the server's lib directory. Jboss won't even start.

      Here are the different properties I tried:

      1) This failed with ClassNotFound exception because I can't include appserv-rt.jar which define the com.sun.enterprise.naming.SerialInitContextFactory class:

      properties.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
       properties.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
       properties.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
      
       properties.setProperty("org.omg.CORBA.ORBInitialHost", "1.2.3.4");
      
       properties.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
      
      


      2) Trying to use Jboss's naming factory but the connection seems to hang there and every return:
      properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       properties.put("java.naming.factory.url.pkgs",
       "org.jboss.naming:org.jnp.interfaces");
       properties.put("java.naming.provider.url", "jnp://1.2.3.4:3700");


      3) A slight varient of 2) I found on the web but same result as in 2)
      properties.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       properties.setProperty("java.naming.factory.url.pkgs", "org.jnp.interfaces.NamingContextFactory");
       properties.setProperty("java.naming.provider.url", "http://1.2.3.4:3700");



      4) Try using the corba naming service in jboss but got NameNotFound exception:
      properties.setProperty("java.naming.factory.initial", "org.jboss.iiop.naming.ORBInitialContextFactory");
       properties.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
       properties.put("java.naming.provider.url", "iiop://1.2.3.4:3700");
      



      Anyone try this before?

      Andy