2 Replies Latest reply on May 10, 2016 6:39 PM by iampowers

    JBoss EJB to WebSphere EJB

    iampowers

      I'm on a WebSphere to JBoss migration project. Does anyone have any experience connecting to an EJB running in another server (like WebSphere) from a JBoss EJB? I need to know what should be in the InitialContext and if there needs to be anything in the jboss-deployment-structure.xml to support it (and anything else that may be needed). Currently, it's being connected to over a URL like the following:

           corbaloc:iiop:123.123.123.123:29123


      I've tried defining various factories and I'm getting class not found errors most of the time. A holistic example would be amazing.

      I saw multiple examples doing it from a standalone client, but none from another EJB.

       

      I've tried the code below. It is deployed in a servlet, in a WAR, in a EAR.

      Properties props = new Properties();
      props.put(Context.PROVIDER_URL, "corbaloc:iiop:123.123.123.123:29123");
      props.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");//should I use "org.jboss.iiop.naming.ORBInitialContextFactory" ???
      InitialContext ic = new InitialContext(props); // throws an exception
      
      
      

       

      I've tried the following jboss-deployment-structure.xml (unsure if it's even required)

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
          <deployment>
              <dependencies>
                  <module name="javax.rmi.api" export="true"/>
                  <module name="org.omg.api" export="true"/>
                  <module name="org.jboss.remote-naming" export="true"/>
              </dependencies>
          </deployment>
      </jboss-deployment-structure>
      
      
      

       

      Server: Jboss EAP 6.4

        • 1. Re: JBoss EJB to WebSphere EJB
          pjhavariotis

          In order to call an EJB running in another application server from a client running in JBoss EAP 6, you can try the following:

           

          // get initial context
          InitialContext ctx = new InitialContext(new Hashtable<String,String>());
          
          String ejbPath = "MySessionBean";
          String lookup = "corbaname:iiop:" + host + ":" + port +"#" + ejbPath;
          
          // lookup the IIOP EJB
          Object iiopObj = ctx.lookup(lookup);
          ...
          
          • 2. Re: JBoss EJB to WebSphere EJB
            iampowers

            I tried the above, but I am getting an odd exception. In researching it sounds like it may be a JDK issue where I have to modify the security policy, which I am unsure how to do in JBoss.

             

            http://stackoverflow.com/questions/25967918/com-sun-corba-class-not-found-in-java-7-update-67

            https://bugs.openjdk.java.net/browse/JDK-6316823

             

            java.util.MissingResourceException: Can't find com.sun.corba.se.impl.logging.LogStrings bundle at 
            java.util.logging.Logger.setupResourceInfo(Logger.java:1537) at java.util.logging.Logger.getLogger(Logger.java:455) at 
            com.sun.corba.se.spi.orb.ORB.getCORBALogger(ORB.java:510) at com.sun.corba.se.spi.orb.ORB.getLogger(ORB.java:497) at 
            com.sun.corba.se.spi.orb.ORB.getLogWrapper(ORB.java:523) at com.sun.corba.se.impl.logging.ORBUtilSystemException.get(ORBUtilSystemException.java:54) at 
            com.sun.corba.se.spi.orb.ORB.(ORB.java:281) at com.sun.corba.se.impl.orb.ORBImpl.(ORBImpl.java:324) at org.omg.CORBA.ORB.init(ORB.java:349) at 
            com.sun.jndi.toolkit.corba.CorbaUtils.getOrb(CorbaUtils.java:203) at com.sun.jndi.cosnaming.CNCtx.getDefaultOrb(CNCtx.java:72) at 
            com.sun.jndi.cosnaming.CNCtx.initUsingCorbanameUrl(CNCtx.java:351) at com.sun.jndi.cosnaming.CNCtx.initUsingUrl(CNCtx.java:284) at 
            com.sun.jndi.cosnaming.CNCtx.createUsingURL(CNCtx.java:121) at com.sun.jndi.url.iiop.iiopURLContextFactory.getUsingURLIgnoreRest(iiopURLContextFactory.java:73) at
             com.sun.jndi.url.iiop.iiopURLContext.getRootURLContext(iiopURLContext.java:61) at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:200) at 
             javax.naming.InitialContext.lookup(InitialContext.java:411) at javax.naming.InitialContext.lookup(InitialContext.java:411) at 
             com.test.ejbClient.getRemoteConnectionForMethod(ejbClient.java:168) at com.test.ejbClient.runBimBis(ejbClient.java:85) at 
             com.test.TestRemoteEJB.doGet(TestRemoteEJB.java:58) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at 
             javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) at 
             org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) at 
             org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) at 
             org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) at 
             org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150) at 
             org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) at 
             org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) at 
             org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) at 
             org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854) at 
             org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) at 
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) at java.lang.Thread.run(Thread.java:745) 
            

             

            I'm still attempting to research why I'm getting the above error.