14 Replies Latest reply: Jun 22, 2012 1:08 PM by swoeste RSS

    [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication

    swoeste Newbie

      Hey Guys,

       

      I am still migrating our application from JBoss 4 -> JBoss 7 and have a problem again.

       

      I have a EAR which invokes a method of another EAR. If the method expects an object which exists in any module in /jboss/modules/* and in the /lib folder of our EAR the invocation failes with an exception (java.lang.IllegalArgumentException: object is not an instance of declaring class). We tried to exclude the module in the jboss-deployment-structure.xml in both EARs but that did not work. Has anyone an idea whats going wrong here? Or is this a problem/bug in jboss?

       

      If created a test application which uses joda time to reproduce the problem.

       

      jboss-deployment-strucutre.xml:


      <jboss-deployment-structure>
          <deployment>
              <exclusions>
                  <module name="org.joda.time" slot="main"/>
              </exclusions>        
          </deployment>
      
          <sub-deployment name="jboss-as-ejb-in-war.war">
              <exclusions>
                  <module name="org.joda.time" slot="main"/>
              </exclusions>        
          </sub-deployment>
      
      </jboss-deployment-structure>
      

       

      invocation:

       

      private BrainBeanRemote lockupbean() throws NamingException {
                  if ( this.bean == null ) {
                       final Context context = new InitialContext();
                       final BrainBeanRemote local = (BrainBeanRemote) context.lookup( JNDI_LOCAL );
                       final BrainBeanRemote remote = (BrainBeanRemote) context.lookup( JNDI_REMOTE );
      
                       if ( remote != null ) {
                           System.out.println( "Found a remote BrainBean!" );
                           this.bean = local;
                       }
      
                       if ( local != null ) {
                           System.out.println( "Found a local BrainBean!" );
                           this.bean = local;
                       }
      
                       if ( remote != null ) {
                           System.out.println( "Will try to produce the error (internal module) now ..." );
                           remote.setBrainTO( new BrainTO( 1.0 ) );
                           System.out.println( "Will try to produce the error (jboss module: joda time) now ..." );              // this one will fail as descriped above
                           remote.setTimeZone( DateTimeZone.UTC );
                       }
              }
              return this.bean;
          }
      

       

      I have added my test project to reproduce the problem.

      Just unpack Test-Deployment.zip into the deployment folder and open "http://localhost:8080/jboss-as-ejb-in-war-2/" to see the error.