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

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

    swoeste

      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.

        • 1. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
          swoeste

          Because this might be a bug in JBoss i created a Ticket and linked it with this thread.

          • 2. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
            sfcoy

            Unfortunately your test project does not reproduce your problem. I was able to get your example working simply by tweaking the ear project pom and fixing the JNDI names that you use.

             

            {code:xml}         <plugin>

                        <groupId>org.apache.maven.plugins</groupId>

                        <artifactId>maven-ear-plugin</artifactId>

                        <version>2.7</version>

                        <configuration>

                           <version>6</version>

                           <defaultLibBundleDir>lib</defaultLibBundleDir>

                           <skinnyWars>true</skinnyWars>

                           <modules>

                              <webModule>

                                 <groupId>de.zeb.edu</groupId>

                                 <artifactId>ejb3.war</artifactId>

                                 <bundleFileName>ejb3.war.war</bundleFileName>

                                 <contextRoot>/ejb3</contextRoot>

                              </webModule>

                              <ejbModule>

                                 <groupId>de.zeb.edu</groupId>

                                 <artifactId>ejb3.server</artifactId>

                                 <bundleFileName>ejb3.server.jar</bundleFileName>

                              </ejbModule>

                           </modules>

                        </configuration>

                     </plugin>{code}

             

             

            and

             

            {code:java}    private final static String JNDI_LOCAL  = "java:global/ejb3.ear/ejb3.server/BrainBean";

                private final static String JNDI_REMOTE = "java:global/ejb3.ear/ejb3.server/BrainBean!de.zeb.edu.ejb3.api.BrainBeanRemote";{code}

             

             

            A couple of things to note:

            1. setting the bundleFileName in each module gets rid of version numbers from your JNDI names
            2. ejb3.api and joda-time are not jarModules. A jarModule is for standalone ejb client applications, not library jars
            • 3. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
              swoeste

              Hi,

               

              the Test-Deployment.zip should reproduce the problem we have, didnt it?

               

              best regards

              Sebastian

              • 4. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                sfcoy

                The "ear" files in the zip do not contain META-INF/application.xml files. So I don't think they are valid to start with.

                 

                Secondly, your two "ear" files will be loaded into isolated class loaders. Classes in one EAR are not made available to the other EAR.

                • 5. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                  swoeste

                  Hi,

                   

                  on our test systems it starts without any problems and runs into the problem as descripted above.

                   

                  Secondly, if the class loaders of both ears and the jboss itself would really by isolated the problem would not occure.

                  I think the class loader of the jboss itself has a leak and during the serialization the joda-time object (DateTimeZone.UTC) gets corrupted.

                   

                  best regards

                  Sebastian

                  • 6. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                    sfcoy

                    swoeste wrote:

                     

                    Hi,

                     

                    on our test systems it starts without any problems and runs into the problem as descripted above.

                     

                    ...

                     

                    Doesn't that statement contradict itself?

                     

                    Your EAR files are not well formed.

                    • 7. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                      jaikiran

                      Stephen Coy wrote:

                       

                      The "ear" files in the zip do not contain META-INF/application.xml files. So I don't think they are valid to start with.

                       

                       

                      Just a FYI - JavaEE6 doesn't mandate the presence of application.xml files. It's optional.

                      • 8. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                        swoeste

                        Hi,

                         

                        Stephen Coy schrieb:

                         

                        ...

                         

                        Doesn't that statement contradict itself?

                         

                        ...

                         

                        i dont think so.

                         

                        We have some bigger (>200MB) EARs were the problem mentioned above occures. Because i dont want to share such big EARs i created a simple application which just runs and reproduces the problem, so that somebody else could see what happens and maybe could give ous an advice how to solve it or somebody notice that it is a problem with the jboss itself.

                         

                        best regards

                        Sebastian

                        • 9. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                          sfcoy

                          jaikiran pai wrote:

                           

                          Just a FYI - JavaEE6 doesn't mandate the presence of application.xml files. It's optional.

                          I thought that was the case, and then couldn't find the reference.

                           

                          EE.8.1.2 says:

                          A Java EE application may consist of one or more Java EE modules and one Java EE application deployment descriptor.

                          which I've misinsterpreted.

                           

                          EE.8.4.1 goes on to say:

                           

                          (Optional) Create an XML deployment descriptor for the application. The deployment descriptor must be named application.xml...

                           

                          Can't win em all I guess.

                           

                          Sebastian, I will investigate further.

                          • 10. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                            sfcoy

                            Sebastian,

                             

                            I agree there's something wrong here. Are you experiencing this problem only with joda-time parameters or are there other types causing problems?

                             

                            At the moment I suspect that the code that is marshalling the remote call is somehow picking up the org.joda.time.DateTimeZone class from the JBoss modules at some point, but it might not be because it's cloning objects and classes all over the shop.

                             

                            I'm still chasing it down for my own edification right now.

                             

                            (I've been testing on a week old trunk btw)

                            • 11. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                              swoeste

                              Hi,

                               

                              i think there were some other  modules which causing the same problems but im not sure.

                              I will look it up tomorrow.

                               

                              Our test servers are:

                              - JBoss 7.1.1 Final

                              - JBoss 7.1.1 Final with jboss-marshalling 1.3.11 -> 1.3.12 because of AS7-3959

                               

                              best regards

                              Sebastian

                              • 12. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                                sfcoy

                                Based upon your sample I have constructed a maven project that demonstrates the issue. This makes it a bit easier to debug because the source is available for the client and server sides. Code is attached to AS7-4984

                                 

                                With a bit of luck I'll get a chance to do some debugging at the weekend.

                                • 13. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                                  sfcoy

                                  Can you try again with jboss-marshalling 1.3.15.GA? This version works for me.

                                  • 14. Re: [JBoss 7.1.1] Exclusion of Modules does not work with EAR to EAR communication
                                    swoeste

                                    Hi,

                                     

                                    i have followed your comments in the JIRA Ticket and allredy updated the modules in our test servers.

                                    Your attached test project runs after the update and our test project too.

                                    I will test our main applications today to be sure

                                    I crashed my hdd and cant even start a jboss, so i will test it next week

                                     

                                    best regards

                                    Sebastian