1 2 Previous Next 16 Replies Latest reply on Mar 17, 2011 12:11 PM by vaibhavnaik

    Unable to tell JBoss to use Parent_Last=true

    juanavelez

      Hi:

       

      First of all let me say that I have read many of entries in here as well as other places about my issue and the use of the jboss-classloading.xml and it seems nothing works.

       

      My situation is the following: I am using JBoss AS 5.1.0GA. I am deploying a WAR file (not an EAR, not a SAR, nothing but a simple WAR file) which has a bunch of hibernate libraries (3.6.0) in it (WEB-INF/lib). I have tried telling JBoss to use the libraries within the WAR and not the ones provided by itself with no luck. I tried the http://community.jboss.org/wiki/classloadingconfiguration and finally used what Ales Justin suggested http://java.dzone.com/articles/jboss-microcontainer-classloading with no effect. My last try was to include a jboss-classloading.xml file in the WEB-INF directory (a sibling to the web.xml file) whose contents are

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <classloading xmlns="urn:jboss:classloading:1.0" parent-first="false">
      </classloading>

      <?xml version="1.0" encoding="UTF-8"?>

      <classloading xmlns="urn:jboss:classloading:1.0" parent-first="false">

      </classloading>

       

       

      Unfortunately when I run JBoss I get the following message

       

       

      14:35:42,336 ERROR [AbstractKernelController] Error installing to Instantiated: name=jboss.jacc:id="vfszip:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/",service=jacc state=Described mode=Manual requiredState=Configured

      java.lang.ClassNotFoundException: org.jboss.deployment.security.WarJaccPolicy from BaseClassLoader@6d516432{VFSClassLoaderPolicy@7a8946af{name=vfszip:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/ domain=ClassLoaderDomain@70eb67e8{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@58fe64b9} roots=[MemoryContextHandler@1249888770[path= context=vfsmemory://a4ja6v-tsw3z5-gh5d90p1-1-gh5d9bd8-2b real=vfsmemory://a4ja6v-tsw3z5-gh5d90p1-1-gh5d9bd8-2b], ZipEntryHandler@195522436[path=pnsgdp.war/WEB-INF/classes context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/classes], DelegatingHandler@495601942[path=pnsgdp.war/WEB-INF/lib/alstomMarketControl.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/alstomMarketControl.jar], DelegatingHandler@1640256128[path=pnsgdp.war/WEB-INF/lib/alstomTransactiveNode.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/alstomTransactiveNode.jar], DelegatingHandler@537166757[path=pnsgdp.war/WEB-INF/lib/alstomTransmissionZoneSimulation.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/alstomTransmissionZoneSimulation.jar], DelegatingHandler@140432911[path=pnsgdp.war/WEB-INF/lib/com.springsource.org.aopalliance-1.0.0.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/com.springsource.org.aopalliance-1.0.0.jar], DelegatingHandler@171407124[path=pnsgdp.war/WEB-INF/lib/commons-dbcp-1.2.2.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/commons-dbcp-1.2.2.jar], DelegatingHandler@1063962441[path=pnsgdp.war/WEB-INF/lib/commons-pool-1.5.2.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/commons-pool-1.5.2.jar], DelegatingHandler@2067900965[path=pnsgdp.war/WEB-INF/lib/cxf-2.3.0.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/cxf-2.3.0.jar], DelegatingHandler@336175707[path=pnsgdp.war/WEB-INF/lib/cxf-xjc-boolean-2.3.0.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/cxf-xjc-boolean-2.3.0.jar], DelegatingHandler@75632292[path=pnsgdp.war/WEB-INF/lib/cxf-xjc-bug671-2.3.0.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/cxf-xjc-bug671-2.3.0.jar], DelegatingHandler@1989096267[path=pnsgdp.war/WEB-INF/lib/cxf-xjc-dv-2.3.0.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/cxf-xjc-dv-2.3.0.jar], DelegatingHandler@863026620[path=pnsgdp.war/WEB-INF/lib/cxf-xjc-ts-2.3.0.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/cxf-xjc-ts-2.3.0.jar], DelegatingHandler@783850502[path=pnsgdp.war/WEB-INF/lib/dom4j-1.6.1.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/dom4j-1.6.1.jar], DelegatingHandler@1510696416[path=pnsgdp.war/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.aop-3.0.5.RELEASE.jar], DelegatingHandler@575505231[path=pnsgdp.war/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.asm-3.0.5.RELEASE.jar], DelegatingHandler@250071329[path=pnsgdp.war/WEB-INF/lib/org.springframework.aspects-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.aspects-3.0.5.RELEASE.jar], DelegatingHandler@323329324[path=pnsgdp.war/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.beans-3.0.5.RELEASE.jar], DelegatingHandler@1062321558[path=pnsgdp.war/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.context-3.0.5.RELEASE.jar], DelegatingHandler@259384148[path=pnsgdp.war/WEB-INF/lib/org.springframework.context.support-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.context.support-3.0.5.RELEASE.jar], DelegatingHandler@77572026[path=pnsgdp.war/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.core-3.0.5.RELEASE.jar], DelegatingHandler@230467253[path=pnsgdp.war/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.expression-3.0.5.RELEASE.jar], DelegatingHandler@1550105630[path=pnsgdp.war/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.jdbc-3.0.5.RELEASE.jar], DelegatingHandler@1501201653[path=pnsgdp.war/WEB-INF/lib/org.springframework.jms-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.jms-3.0.5.RELEASE.jar], DelegatingHandler@2058297015[path=pnsgdp.war/WEB-INF/lib/org.springframework.orm-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.orm-3.0.5.RELEASE.jar], DelegatingHandler@2131345229[path=pnsgdp.war/WEB-INF/lib/org.springframework.oxm-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.oxm-3.0.5.RELEASE.jar], DelegatingHandler@1492031843[path=pnsgdp.war/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.transaction-3.0.5.RELEASE.jar], DelegatingHandler@412639282[path=pnsgdp.war/WEB-INF/lib/org.springframework.web-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.web-3.0.5.RELEASE.jar], DelegatingHandler@1003716411[path=pnsgdp.war/WEB-INF/lib/org.springframework.web.servlet-3.0.5.RELEASE.jar context=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/WEB-INF/lib/org.springframework.web.servlet-3.0.5.RELEASE.jar]]  delegates=null exported=[]}}

      at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)

      Could someone please shine some light on this? I can not believe something as trivial as to telling JBoss to use the libraries found in the WAR file can be so complicated/complex
      Thanks in advance
      Juan
        • 1. Re: Unable to tell JBoss to use Parent_Last=true
          alesj

          war / web deployments are by default child first (parent-first=false), see servlet spec.

           

          How do you know that the wrong Hibernate classes are picked up?

          Can you try this with the latest JBossAS6_CR1?

           

          My guess is that the Hibernate classes are picked up from CL domain's cache.

          See ClassLoaderDomain::checkCacheAfter.

           

          You will have to change the CL domain's parent policy,

          so that "after" filter also filters out Hibernate packages / classes.

          This feature is already available in AS6_CR1, under https://jira.jboss.org/browse/JBDEPLOY-266.

          * http://community.jboss.org/wiki/JBoss5custommetadatafiles (see jboss-classloading-domain.xml)

          • 2. Re: Unable to tell JBoss to use Parent_Last=true
            juanavelez

            Ales, thanks for your reply. I know that it is not using my 3.6.0 version of Hibernate because 1) the Hibernate log messages indicate 3.3.1 as well as failing because the Slf4j fails with an error indicating that 1.6.1 (the jar I am using) is not compatible with the 1.5.5. binding (the one in JBoss 5.1.0GA) and 2) because Hibernate can not start due to a "NoMethodException" that it is not thrown when I run my app outside of JBoss.

             

            My deployment characteristics require that I use solely JBoss 5.1.0GA and no other version (younger or older for that matter). Anyway, the problem now as you might notice from my initial post is that whenever I use the jboss-classloading.xml file I get those errors, so if I am to follow your advice it won;t work as it currently fails. Any idea what causes this failure using the jboss-classloading.xml file?

             

            14:35:42,336 ERROR [AbstractKernelController] Error installing to Instantiated: name=jboss.jacc:id="vfszip:/D:/java/containers/jboss-5.1.0.GA/server/default/deploy/pnsgdp.war/",service=jacc state=Described mode=Manual requiredState=Configured

            java.lang.ClassNotFoundException: org.jboss.deployment.security.WarJaccPolicy from

             

            Thanks

            • 3. Re: Unable to tell JBoss to use Parent_Last=true
              alesj

              Can you track down who actually loads those Hibernate classes?

              e.g. is it your code or some existing code that's already part of DefaultDomain

              If it's the later, then this explains it -- that code only sees JBoss' Hibernate, not yours.

               

              No idea what's this new exception -- WarJaccPolicy. :-(

              • 4. Re: Unable to tell JBoss to use Parent_Last=true
                dskiles

                Did you ever find a way around this?  I'm running into a very similar problem with CXF in JBoss 6.

                • 5. Re: Unable to tell JBoss to use Parent_Last=true
                  npi

                  sorry for the late reply. No, I never got an answer about this.

                  • 6. Re: Unable to tell JBoss to use Parent_Last=true
                    alesj

                    No, I never got an answer about this.

                    Well, we can only guess what's going on.

                    Unless you're willing - like I already said - to debug who's actually loading the initial Hibernate classes.

                    If it's JBoss code, that this explains it, if it's your code then we need to dig deeper.

                    • 7. Re: Unable to tell JBoss to use Parent_Last=true
                      dskiles

                      I've done a little bit of research on my end and it looks like the problem may stem from the jaxb-xjc library.  In my case it is in my war file and it is in the jboss 6 "bootstrap" folder.

                       

                      How does the bootstrap classloader relate to the other classloaders?  Is this a symptom of the bootstrap classloader overriding the jboss-classloading.xml, possibly?

                      • 8. Re: Unable to tell JBoss to use Parent_Last=true
                        alesj

                        Boostrap classloader is the parent of default cl domain.

                        So same rules should apply.

                        • 9. Re: Unable to tell JBoss to use Parent_Last=true
                          dskiles

                          Hrm, that kills that theory.  Is there any information that I can post up here that would be useful in tracking down the root of this problem?  I've been banging on it for about a month now with JBoss 6 and haven't figured anything out yet.

                          • 10. Re: Unable to tell JBoss to use Parent_Last=true
                            alesj

                            Which theory?

                             

                            Like I said, twice already :-), the info that we need is the following:

                            * who loads the "illegal" class

                            * what's the classloader used to load this class

                            • 11. Re: Unable to tell JBoss to use Parent_Last=true
                              dskiles

                              My thought was that the bootstrap wasn't obeying the jboss-classloading.xml directives.

                               

                              I'm not entirely experienced with the JBoss 6 classloader architecture; how can I get the information that you have requested?

                              • 12. Re: Unable to tell JBoss to use Parent_Last=true
                                alesj
                                I'm not entirely experienced with the JBoss 6 classloader architecture; how can I get the information that you have requested?

                                Debugging. :-)

                                 

                                I guess some conditional break point in our BaseClassLoader::loadClass

                                e.g. if (className == "com.acme.MyIllegalBootClass") // pseudo code

                                 

                                Then we'll probably be able to see who's the initial caller and which CL is used atm.

                                • 13. Re: Unable to tell JBoss to use Parent_Last=true
                                  dskiles

                                  I'll grab the source and see what I can accomplish.

                                  • 14. Re: Unable to tell JBoss to use Parent_Last=true
                                    alesj
                                    I'll grab the source and see what I can accomplish.

                                    I suggest using the AS6 source (http://anonsvn.jboss.org/repos/jbossas/trunk/) and setting it up in IDE.

                                    e.g. I use IntelliJ' remote debugging, very trivial to setup (see JBoss' run.conf script at the end with commented remote debug line)

                                     

                                    (if the issue is in AS6 then it will be also in AS5.1)

                                    1 2 Previous Next