5 Replies Latest reply on Apr 7, 2011 8:51 AM by alesj

    Classloading for a Tomcat war under Jboss 5.1

    spulci

      Hallo,

       

      i've got my web application war originally developed under Tomcat and I'm experiencing issues with JBoss deploying. My scenario gives me no access to modify JBoss common/lib presence so the only chance I've got is to add the right descriptor jboss-classloading.xml to my WEB-INF to instruct the classloader to give precedence to my web-inf/lib.

       

      My web app uses Hibernate 3.5 jars as well as Struts 1.3.10 and other framework. I defined this classloader tag:

       

      [code]

      <classloading xmlns="urn:jboss:classloading:1.0"

                    domain="WebReportFFDeploy.war"

                    export-all="NON_EMPTY"

                    import-all="true"

                    parent-first="false" >

      </classloading>

      [/code]

       

      where domain is my war name but this not fix my issue. Jboss still uses the hibernate jar in common lib to solve classes ignoring my hibernate jars in my web-inf/lib (I used a new method present only in the last version of Hibernate. Hibernate version present in JBoss can do the same using a deprecated method and I really don't want to touch the code). My goal is to give higher precedence to my web-inf/lib to avoid conflicts in version and dependencies. I'm newbie at JBoss but this issue is becoming too time consuming for me. I hope that JBoss community documentation will add soon tutorial and examples to explain this descriptors in a clear way.

       

      Thanks a lot

       

      Simon

       

      P.S. Please note that at the moment I get a sessionfactory binding an Hibernate Util class to my web application listener. I hope this doesn't cause other issues thought I will soon bind to a JNDI resource.

        • 1. Classloading for a Tomcat war under Jboss 5.1
          alesj

          Changing Hibernate is far from trivial.

          Read all about it here: http://community.jboss.org/message/579108#579108

          • 2. Classloading for a Tomcat war under Jboss 5.1
            spulci

            Thanks, btw I tried to remove hibernate-validator.jar from common/lib to see my app correctly deployed...at least it starts but there's one more issue. My Jboss distribution is bundled inside Liferay CMS; I can't touch common/lib anymore and my web app is using Struts 1.3. Integrating into a liferay portlet Struts is no more recognized obtaining a 500 error and this stack trace:

             

            [code]

            javax.servlet.ServletException: Cannot find catalog 'struts'

            org.apache.struts.chain.ComposableRequestProcessor.init(ComposableRequestProcessor.java:161)

            org.apache.struts.action.ActionServlet.getRequestProcessor(ActionServlet.java:620)

            org.apache.struts.action.ActionServlet.process(ActionServlet.java:1910)

            org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)

            javax.servlet.http.HttpServlet.service(HttpServlet.java:617)

            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

            [/code]

             

            I suspect for this error I should check liferay community even if I'm using the classloading descriptor above to give precedence to my web-inf/lib.

             

            It's a real nightmare!

             

            Thanks for your help

             

            Simon

            • 3. Classloading for a Tomcat war under Jboss 5.1
              alesj
              even if I'm using the classloading descriptor above to give precedence to my web-inf/lib.

              Servlet spec already forces precedence of .war resources.

               

              What you're seeing is that integration code gets mingled with app's resources,

              which is, as you can read, a hard problem to avoid.

              1 of 1 people found this helpful
              • 4. Classloading for a Tomcat war under Jboss 5.1
                spulci

                Btw the exception above is due to a load-on-startup tag inside the web.xml. Jboss does not like the give priority; removing this tag the deploy runs fine. It maybe caused by several servlet loaded by Struts and Birt together in the same application. If you don't have special needs, best practice is to not specify load-on-startup, leaving the loading order to the servlet container. Hope I'm right.

                 

                Thanks for your help.

                 

                Simon

                • 5. Classloading for a Tomcat war under Jboss 5.1
                  alesj
                  Jboss does not like the give priority; removing this tag the deploy runs fine.

                  Hmm, I doubt that's the issue.

                  Afaik, this is per spec, hence order def should be allowed.

                  e.g. JBoss is not GAE where you wanna have all lazy behavior :-)