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

    Accessing EJB 2.1 in a isolated EARs

    gjeudy

      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

        • 1. Re: Accessing EJB 2.1 in a isolated EARs

          I have the same problem.

          I am using CallByValue=false and Isolated=true.

          I have added correctly the ejb-ref into the jboss.xml and ejb-jar.xml, and in my company we are using Jboss As 4.2 cp07.

          I can succesfully lookup the EJB, but I get this exception:

          Invalid invocation, check your deployment packaging, method=public abstract
          


          when I do the create.

          Can you help me?

          Thanks.

          • 2. Re: Accessing EJB 2.1 in a isolated EARs
            gjeudy

            @ghepardo,

            I came to the conclusion that it's not possible to use CallByReference between 2 ears with classloader isolation. You have to enable CallByValue, this makes class translation between classloaders possible through the use of Java serialization.

            See this: http://www.jboss.org/community/wiki/classloadingconfiguration.

            I tried both options suggested in this article. I was able to make it work only with CallByValue=true in EARDeployer though... The other option failed with the familiar:

            Invalid invocation, check your deployment packaging
            message.