4 Replies Latest reply on Aug 27, 2012 6:39 AM by abhaydani

    EAR classloader issue?

    abhaydani

      I am trying to deploy EAR on JBOSS 7.1.0.Final.I am using Spring 3.1.1-Release.jars.Actually I had a web application before and all Spring related jars were in WEB-INF/lib. Now I have added MDB for async functionality and hence moved all the Spring specific jars in EAR/lib as it will used by both MDB and WEB APP and I have configured Spring context to be shared between WEBAPP & EAR.  I am getting following exception during deployment, but org.springframework.beans-3.1.1.RELEASE.jar is already present in EAR/lib.I also tried to move all jars to one level above lib and refer through manifest. Nothing worked. jboss-deployment-structure.xml and global-module also didn't work.Can anyone look in to this?   Also please post detailed configuration for jboss-deployment-structure.xml and global-module in standalone.xml if its the root cause of the problem.But I understand that it is no different that placing the jars in EAR/lib.    AN EARLY REPLY WILL BE HIGHLY APPRECIATED AS I HAVE A TIGHT DEADLINE.   Thanks, Abhay   ERROR AS FOLLOWS :   20:41:06,125 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-2) Context initialization failed: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/aop] Offending resource: ServletContext resource [/WEB-INF/application-context.xml]         at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:316) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1416) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1409) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:184) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:140) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:111) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180) [org.springframework.beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125) [org.springframework.web-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94) [org.springframework.web-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131) [org.springframework.context-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522) [org.springframework.context-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436) [org.springframework.context-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385) [org.springframework.web-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284) [org.springframework.web-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111) [org.springframework.web-3.1.1.RELEASE.jar:3.1.1.RELEASE]      at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.10.Final.jar:]      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.10.Final.jar:]      at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.0.Final.jar:7.1.0.Final]      at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0]      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0]      at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0]

        • 1. Re: EAR classloader issue?
          grossetieg

          Hi,

           

          The error seems to indicate that your server is not connected to Internet and you cannot retrieve the xsd for Spring.

          You can try to add the following lines to the jboss-deployment-structure.xml to "export" xsd :

           

             <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
                  <deployment>
                      <dependencies>
                          <module name="org.apache.commons.logging"/>
                          <module name="org.springframework" >
                              <imports>
                                  <include path="META-INF**"/>
                                  <include path="org**"/>
                              </imports>
                          </module>
                      </dependencies>
              </jboss-deployment-structure>
          

          http://stackoverflow.com/questions/8098684/spring-module-in-jboss-7

          Note : You will need a JBoss module named org.springframework

           

          I think that you can do the same configuration at module level with the module.xml file.

           

          If it's not working check that your deployment have the Spring AOPdependency.

           

           

          Guillaume.

          • 2. Re: EAR classloader issue?
            abhaydani

            Hi,

             

            Thanks for a quick reply.

             

            I have added module.xml as below in modules/org/springframework/main,

             

            <module xmlns="urn:jboss:module:1.1" name="org.springframework">

                  <resources>

                    <resource-root path="org.springframework.beans-3.1.1.RELEASE.jar"/>

                    <!-- Insert resources here -->

                </resources>

             

            </module>

             

            and copied org.springframework.beans-3.1.1.RELEASE.jar (which contain xsd) in modules/org/springframework/main

             

            also added the entry in jboss-deployment-structure.xml in ejbModule/Meta-INF

             

            <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
                    <deployment>
                        <dependencies>
                            <module name="org.springframework" >
                                <imports>
                                    <include path="META-INF**"/>
                                    <include path="org**"/>
                                </imports>
                            </module>
                        </dependencies>
            </jboss-deployment-structure>

             

            but problem persists.

             

            Is there anything missing?

             

            I am wondering when it was just a war , everything was working fine without any configuration ... any clue?

             

             

            Thanks,

            Abhay


            • 3. Re: EAR classloader issue?
              grossetieg

              Hi,

               

              Have you tried to declare a global module in the standalone.xml/domain.xml ?

               

              <subsystem xmlns="urn:jboss:domain:ee:1.0" >
                <global-modules>

                  <module name="org.springframework" slot="main">

                    <imports>

                       <include path="META-INF**"/>

                       <include path="org**"/>

                    </imports>

                </global-modules>

              </subsystem>

               

               

              Guillaume.

              • 4. Re: EAR classloader issue?
                abhaydani

                Hi,

                 

                Thanks for your help.The problem is resolved after adding dependency of aop jars apart from spring like aspectweaver.jar,aop-alliance.jar etc. i.e your last pointer helped ... it was related to complete aop dependencies apart from Spring aspects jars and spring beans jars which carries the  xsds.

                 

                 

                Thanks for your help.

                 

                Thanks,

                Abhay