3 Replies Latest reply on May 14, 2013 4:58 PM by ccaspanello

    EAR 'lib' Directory and Classloader (JBoss AS 7.1.1 Final)

    ccaspanello

      Hey guys,

       

      I've got the following EAR structure:

       

      EAR.ear

      -- META-INF

        -- application.xml

        -- MAINFEST.MF

      -- WAR1.war

      -- WAR2.war

      -- EJB1.jar

      -- EJB2.jar

      -- lib

         -- primefaces.jar

         -- ... other third party libraries ...

       

      In this case both my WAR files use the PrimeFaces package.  I've deployed this same application in TomEE and Glassfish, so I know the application works.  My problem is when trying to migrate to JBoss AS7 it does not recoginze the third party libraries in the EAR/lib directory.  From reading StackOverflow and this forum this should be a no brainer and 'lib' is the default library name for shared resources.  Can anyone shed some light on why something so simple isn't working?  Am I missing something here?  Do I need another JBoss configuration file?  Note, I have tried moving the primefaces.jar into each of the 2 WAR/lib directories.  However, this is putting duplicate jars in my EAR project.  It is perfered (and probablly best practice) to keep shared jars in one location in the EAR/lib directory.

       

      Thanks,

      Chris

        • 1. Re: EAR 'lib' Directory and Classloader (JBoss AS 7.1.1 Final)
          dmen

          I am writing this in great anger! I have the same problem with other libraries instead of JSF.

           

          JBoss 7 gives its own builtin libraries priority over the ones in your package and this causes massive deployment problems.

          You can try excluding modules, one by one, but we all know that this is hard as hell and leads to an buggy server enviroment.

           

          You cannot deploy standard wars with bundled libraries!

          This is against the JavaEE standard and really IMHO a mallicious tactic from RedHat to force you tie your app to the JBoss enviroment!

          • 2. Re: EAR 'lib' Directory and Classloader (JBoss AS 7.1.1 Final)
            jaikiran

            Chris Caspanello wrote:

             

            Hey guys,

             

            I've got the following EAR structure:

             

            EAR.ear

            -- META-INF

              -- application.xml

              -- MAINFEST.MF

            -- WAR1.war

            -- WAR2.war

            -- EJB1.jar

            -- EJB2.jar

            -- lib

               -- primefaces.jar

               -- ... other third party libraries ...

             

            In this case both my WAR files use the PrimeFaces package.  I've deployed this same application in TomEE and Glassfish, so I know the application works.  My problem is when trying to migrate to JBoss AS7 it does not recoginze the third party libraries in the EAR/lib directory.

            What exact exceptions do you run into? Please post the entire exception stacktrace.

             

            Also as a quick check, have you tried this against a latest released version to see if it works there?

            • 3. Re: EAR 'lib' Directory and Classloader (JBoss AS 7.1.1 Final)
              ccaspanello

              Hey guys,

               

              I jumped on the JBoss IRC forum the other night and was able to resolve my issue.

               

              JBoss only loads the JSF libraries into WAR modules.  PrimeFaces is a GUI component library which relies on the JSF libraries to be present.  Moving the PrimeFaces libaries into each of the WAR files solved my issue.  Other 'non JSF dependant' libraries inside the EAR 'lib' directory were properly loaded and accessible in all of the EJB/WAR modules.

               

              Thanks,

              Chris