0 Replies Latest reply on Jan 12, 2009 9:51 AM by Mat B

    Accessing weblogic ejb from jboss

    Mat B Newbie

      Hello,

      I am currently trying to access an EJB Session deployed in a Weblogic server from JBOSS.

      The client code looks like this :


       Hashtable environment = new Hashtable();
       environment.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
       environment.put(Context.URL_PKG_PREFIXES, "weblogic.jndi.factories");
       environment.put(Context.PROVIDER_URL, "t3://<ip>:<port>");
       InitialContext context = new InitialContext(environment);
      
       ServiceHome home = (ServiceHome)context.lookup("ejb/Service");
      


      When I run this code from a standalone java program it executes ok, but when I try to run it from an application deployed in JBOSS, the line (5) which creates the InitialContext object throws this Exception :
      java.lang.ThreadDeath
       org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1221)
       org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
       weblogic.rmi.internal.StubGenerator.getStubClass(StubGenerator.java:696)
       weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:742)
       weblogic.rmi.internal.StubGenerator.generateStub(StubGenerator.java:729)
       weblogic.rmi.extensions.StubFactory.getStub(StubFactory.java:79)
       weblogic.jndi.WLInitialContextFactoryDelegate.newRootNamingNodeStub(WLInitialContextFactoryDelegate.java:497)
       weblogic.jndi.WLInitialContextFactoryDelegate.newRemoteContext(WLInitialContextFactoryDelegate.java:460)
       weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:364)
       weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:327)
       weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:253)
       weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:135)
       javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
       javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
       javax.naming.InitialContext.init(Unknown Source)
       javax.naming.InitialContext.<init>(Unknown Source)
      


      In order to be able to use weblogic naming factory I put the archive weblogic-8.1.6.0.jar in jboss's /server/default/lib directory.
      But I think it has to do with JNDI conflicts between JBOSS and weblogic.

      If someone has already done this or has an idea about the problem ... thank you for your help.