1 Reply Latest reply on Jun 6, 2005 11:05 AM by Gerald Quintana

    EAR and Class loading

    Gerald Quintana Newbie

      Hello everybody,

      I have 2 session beans:
      - Session1Bean in Ejb1.jar in App1.ear
      - Session2Bean in Ejb2.jar in App2.ear

      Each EAR has its own class loader because there is

      <loader-repository>App1Loader:loader=unique-archive-name</loader-repository>

      App1.ear\META-INF\jboss-app.xml and
      <loader-repository>App2Loader:loader=unique-archive-name</loader-repository>

      App2.ear\META-INF\jboss-app.xml.

      The Session2 EJB can not access to the Session1 EJB using the remote interface. I get a ClassCastException in Session2 when I try to cast the home object of Session1 found in the JNDI registry into Session1Home interface. Session1Home.class of Ejb1.jar is also present in Ejb2.jar, the files are identical.

      Why do I get this ClassCastException since this home should fit in the interface?

      What can I do to solve this?

      Thanks for your help
      Gérald

        • 1. Re: EAR and Class loading
          Gerald Quintana Newbie

          Since then I have tried many things:


          • Add a <call-by-value>true</call-by-value> in the jboss.xml of both EJB jars
          • Set naming service attribute CallByValue to true in jboss-service.xml
          • Specify JNDI properties when instantiating the InitialiContext


            Despite all my trials and my forum searches, nothing worked. Does some have an idea?

            I forgot to tell I was using JBoss 4.0