3 Replies Latest reply on Jun 21, 2010 9:10 PM by pucky

    lib/*.jar sort issue exploded.ear vs compiled.ear on Linux not OSX

    pucky

      Ok I'm sure the subject of this sounds a bit odd, but I have a really interesting issue on my hands.

       

      I have a J2EE app that is currently deployed as an exploded ear directory and it contains a lib directory off the root of the myapp.ear.  I've needed to deal with a library getting loaded into the UCL before another by adding 1_ to it's name.  This app has been running for years on the same OSX system. 

       

      I'm currently trying to move it to a linux box and have run into an odd issue with the deploying it exploded vs compiled.

       

      myapp.ear  works great on osx

      myapp-exploded.ear/  works great on osx

       

      myapp.ear works great on linux

      myapp-exploded.ear does not work on linux.

       

      The issue seems to be that the jars are getting loaded into the UCL in a different order when it's exploded on linux.  I've been doing some investigating into the logs and the see that the "RepositoryClassLoader" is adding url's the exact same for all deployments except "linux exploded".  It almost seems that the linux exploded is not ordered at all, it looks random. 

       

      The way I've tested this is by deploying the code to the same jboss and copying it over to the linux system (complete jboss install) and redeploying there the 2 different ways.

       

      Can anyone tell me what is the class that sorts the files in the ear/lib directory?  I'm thinking this must be a bug but can't prove it yet without looking at the code.

       

      it seems odd that sorting would be different on a *nix system.

       

      Any help would be great.

       

      Cheers,

      Pucky

        • 1. Re: lib/*.jar sort issue exploded.ear vs compiled.ear on Linux not OSX
          jaikiran

          Which version of JBoss AS is this? And which version/vendor of Java?

          • 2. Re: lib/*.jar sort issue exploded.ear vs compiled.ear on Linux not OSX
            pucky

            sorry about that, totally forgot to mention the versions.

             

            LINUX: (CENTOS 5.4 FINAL)

            JBoss 4.2.2.GA

            Sun JDK 1.6.0_20

             

            OSX: (OSX 10.6.3)

            Apple's JDK 1.6.0_20

            exact same JBoss instance JBoss 4.2.2.GA

             

            it's very interesting, I've done some searching and haven't found anything regarding this kind of issue.

             

            Cheers,

            Pucky

            • 3. Re: lib/*.jar sort issue exploded.ear vs compiled.ear on Linux not OSX
              pucky

              I've run the following on OSX and Linux.

               

              When run on the linux system it's output matches the order of the RepositoryClassLoader "add url" in the -exploded.ear deployment scenario.  There for it looks like this is related to the File.list() implementation on each OS and therefore The RepositoryClassLoader should implement a specific Comparator so that the it would work the same on each OS.  Do you agree?

              public class DirectoryListing {
              
              
                public static void main(String[] args){
              
                  if(args.length == 1) {
                      File directory = new File(args[0]);
                      String[] fileNameArray = directory.list();
                      if(fileNameArray != null){
                        for(int i = 0; i < fileNameArray.length; i++){
                          String fileName = fileNameArray[i];
                          System.out.println(fileName);
                        }
                      }
                  }
                    else
                  {
                      System.out.println("you need to pass the directory path to list.");
                  }
              
                }
              }