0 Replies Latest reply on Aug 5, 2010 7:06 AM by Marcio Joffily

    Need help deploying two instances of same EAR to jBoss 4.2.3.GA

    Marcio Joffily Newbie

      Hi All,

       

      I've been trying to deploy two EAR files, containing a WAR and one EJB.

       

      The EJBs have the same JNDI name but I need to be able for the WAR to access the ejb deployed in the containing EAR.

       

      I deploy EAR1 and can access the ejb without a problem

       

      I deploy EAR2 and now the EAR1 throws a ClassCastException whereas EAR2 works fine:

       

      a.jpg

       

       

      EAR 1 has the following application.xml:

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
      <application id="Application_ID">
          <display-name>testContextListenerEAR1</display-name>
          <module id="EjbModule_1280999695035">
              <ejb>testContextListenerEJB-1.0-SNAPSHOT.jar</ejb>
          </module>
          <module id="WebModule_1279769610891">
              <web>
                  <web-uri>testContextListener-0.0.1-SNAPSHOT.war</web-uri>
                  <context-root>/marcio-ear1</context-root>
              </web>
          </module>
      
      </application>
      

       

      And the following jboss-app.xml

       

       

      <jboss-app>
          <loader-repository>
              com.mbl.bfs:archive=ear1.ear
              <loader-repository-config>
                  java2ParentDelegation=true
              </loader-repository-config>
          </loader-repository>
      </jboss-app>
      

       

      EAR 2 has the following application.xml (notice a different version of the same EJB)

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
      <application id="Application_ID">
          <display-name>testContextListenerEAR2</display-name>
          <module id="EjbModule">
              <ejb>testContextListenerEJB-2.0-SNAPSHOT.jar</ejb>
          </module>
          <module id="WebModule_1279769611734">
              <web>
                  <web-uri>testContextListener-0.0.1-SNAPSHOT.war</web-uri>
                  <context-root>/marcio-ear2</context-root>
              </web>
          </module>
      </application>
      
      

       

      and jboss-app.xml

       

       

      <jboss-app>
          <loader-repository>
              ear2:archive=ear2.ear
              <loader-repository-config>
                  java2ParentDelegation=true
              </loader-repository-config>
          </loader-repository>
      </jboss-app>
      

       

      By doing this, I thought the classloaders would be isolated and I would be able to call each ejb separately (although they both share the same JNDI name).

       

      I'm attaching both ear files as they are quite simple.

       

      Could you provide any help in pointing out what I might be missing?

       

      Thanks,

      MJ