2 Replies Latest reply on Sep 10, 2009 9:18 AM by Guillaume Jeudy

    Accessing EJB 2.1 in a isolated EARs

    Guillaume Jeudy Master

      Hi,

      I'm trying to access EJBs in isolated EARs in JBoss 4.2.2.GA in the same server instance. Is it possible to only enable Call by Value semantics for 1 EJB and not for all EJBs deployed in an EAR?

      I tried countless combinations and the only one that seemed to work is the below:

      I have EJBA in ear1 access EJBB in ear2 both are isolated using loader-repository in their jboss-app.xml:

      <jboss-app>
       <loader-repository>loader=ear1</loader-repository>
      </jboss-app>
      
      <jboss-app>
       <loader-repository>loader=ear2</loader-repository>
      </jboss-app>
      


      enable call by value in the ear-deployer.xml:

      <attribute name="CallByValue">true</attribute>
      


      EJBA code to access EJBB:

      Context testcontext = new InitialContext();
      EJBBHome objref = (EJBBHome)testcontext.lookup("jnp://localhost:1299/ejb/EJBB");
      log.info("Looked up ejbb:" + objref);
      objref.create().doSomething();
      


      The call succeeds but as soon as I set CallByValue=false, I get:

      2009-08-27 15:25:00,401 ERROR [org.jboss.ejb.plugins.LogInterceptor] TransactionRolledbackException in method: public abstract testearisolation.ear2.EJBB testearisolation.ear2.EJBBHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException, causedBy:
      javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract testearisolation.ear2.EJBB testearisolation.ear2.EJBBHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException
      


      I could use my working solution but then if I understand correctly it means all EJBs for all EARs under this server instance will use Call By Value semantics regardless if its 2 EJBs talking to each other in the same EAR...

      Please correct me if im wrong.

      Thanks
      -Guillaume