11 Replies Latest reply on Jul 10, 2014 8:53 AM by Varun Saddi

    jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar

    maltiyadav Newbie

      Hi ,

      I am migrating my application from jboss-4.0.3SP1 to jboss-5.1.0.GA.

      spring jars are upgraded with 3.0.5 version.

      Now while deploying the application it gives following error.

      i have removed all jars from my war which are available in jboss server.

      I have only SAX-2.0.jar in my war and if i delete it my app is not working at all its required jar.

      i have attached server log here for more clarity.

       

       

      2011-07-05 11:25:48,195 ERROR [org.springframework.web.context.ContextLoader] (main) Context initialization failed

      org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.parsers.DocumentBuilder.setEntityResolver(Lorg/xml/sax/EntityResolver;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/springframework/beans/factory/xml/DefaultDocumentLoader, and the class loader (instance of <bootloader>) for resolved class, javax/xml/parsers/DocumentBuilder, have different Class objects for the type org/xml/sax/EntityResolver used in the signature

                at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:412)

                at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)

                at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)

       

      Jars in use :

      jars.jpg

        • 1. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
          Wolfgang Knauf Master

          Hi,

           

          just for the records: continued discussion from here: http://community.jboss.org/thread/168617

           

          Do you really need the SAX 2 lib? As far as I know, the java runtime contains already a SAX parser (open "rt.jar" and you will find a package "org\xml\sax\" inside).Or do you or an other component force the use of SAX 2?

           

          I see that you also bundle several JARs which are part of JBoss already - those might cause conflicts, too. Those are: "j2ee", "jms", maybe "jts-spech1_0_1". Your app should deploy without them.

           

          Best regards

           

          Wolfgang

          • 2. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
            maltiyadav Newbie

            i agree that rt.jar has the SAX.jar inside.And without SAX.jar i am able to build my application also but when i deploy it nothing will happen.Server stops during on point of deploying /WEB-INF/applicationContext.xml and i have to forcefully stop the server it doesnt move after that.Attaching server.xml and /WEB-INF/applicationContext.xml.

             

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

            <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

            <beans>

                      <bean id="testBean" class="org.test.core.business.TestBO">

                      </bean>

            ............................

            </beans>

            • 4. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
              Wolfgang Knauf Master

              Whow, that's not nice...  a "java.lang.OutOfMemoryError: Java heap space" at "org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions"

               

              First thing to try: give JBoss more memory: take a look at "bin\run.conf.bat" (if using windows) or "run.conf" (Linux) and edit the "JAVA_OPTS".

              E.g. this might help: "-Xms1024M -Xmx1024M" (see e.g. here for some more details on JBoss memory settings: http://www.datadisk.co.uk/html_docs/java_app/jboss5/jboss5_tuning.htm )

               

              If this does not work, there is maybe a spring issue. Maybe it helps to trace the problem by activating some spring internal logger (e.g. http://static.springsource.org/spring/docs/2.0.2/api/org/springframework/beans/factory/xml/DefaultBeanDefinitionDocumentReader.html provides an internal logger, so I assume that you can activate this logging), but I don't know how to do this for JBoss.

               

              Hope this helps

               

              Wolfgang

              • 5. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
                maltiyadav Newbie

                Hi,

                 

                As you suggested i removed most of the jars from my application.

                And after removing dom.jar i can see a bit progress in the deployment but still its stopping for a long time.

                After incrementing VM memory argument the memory size issue is not coming but still deployement is not happening it stops

                while loading applicationContext.zml.

                I am attching server logs here.

                Now its loading tleast beans but still it stops without giving any error.

                Spring loggers i enabled but not helping much.i can see debug logs which are not much helpfull.

                i am not able to understand whats missing exactly.

                here j2ee jar is only for compilation i am exluding it while building war.

                 

                jars.jpg

                • 6. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
                  Wolfgang Knauf Master

                  Hi,

                   

                  the list of dependencies looks much better now ;-). What are the "web-app-_2_x" files? If they are JAR files containing e.g. the "javax.servlet" classes, I suggest you also don't deploy them.

                   

                  Is the server "hanging", or is there just no more console output? Maybe deployment is successful, but there is just missing a message "deploy succeeded". Did you try to start your web app?

                   

                  If deployment is really hanging, you might try to take a thread dump to find more information: http://community.jboss.org/wiki/ThreadDump

                   

                  Best regards

                   

                  Wolfgang

                  • 7. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
                    maltiyadav Newbie

                    server is hanging its not starting at all i tried to start web app no use

                    I have ThreadDump tool and it trace following logs:

                    After rmoving SAX.jar it happens.Files like web-app-_2_x are DTD files.

                     

                    "main" prio=6 tid=0x019d5400 nid=0x9c8 runnable [0x0541d000]

                       java.lang.Thread.State: RUNNABLE

                            at java.lang.ClassLoader.defineClass1(Native Method)

                            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)

                            at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)

                            at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:572)

                            at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:532)

                            at java.security.AccessController.doPrivileged(Native Method)

                            at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:530)

                            - locked <0x265944e0> (a org.jboss.classloader.spi.base.BaseClassLoader)

                            at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:507)

                            at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)

                            at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)

                            at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)

                            at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:251)

                            at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:150)

                            at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:265)

                            at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1119)

                            at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:798)

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

                            - locked <0x265944e0> (a org.jboss.classloader.spi.base.BaseClassLoader)

                            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

                            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

                            - locked <0x265944e0> (a org.jboss.classloader.spi.base.BaseClassLoader)

                            at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.registerBeanDefinitions(DefaultXmlBeanDefinitionParser.java:187)

                            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:295)

                            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:223)

                            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)

                            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)

                            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:129)

                            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:145)

                            at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:126)

                            at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)

                            at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)

                     

                     

                            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:262)

                            at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)

                     

                     

                            at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:252)

                            at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190)

                            at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)

                            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)

                            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)

                            - locked <0x2933f368> (a org.apache.catalina.core.StandardContext)

                            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:310)

                            at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:142)

                            at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)

                            - locked <0x2905b388> (a org.jboss.web.tomcat.service.deployers.TomcatDeployment)

                            at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)

                            - locked <0x2905b370> (a org.jboss.web.deployers.WebModule)

                            at org.jboss.web.deployers.WebModule.start(WebModule.java:97)

                    • 8. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
                      Wolfgang Knauf Master

                      Sorry, but I cannot provide you further help, because now we reach the area of JBoss and spring internals. Hopefully one of the gurus can provide more help.

                       

                      If possible you might try to create and post a small sample which reproduces this problem - this makes it easier to help. And sometimes the sample app simply works and you find the difference to your own app ;-)

                       

                      Best regards

                       

                      Wolfgang

                      • 9. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
                        maltiyadav Newbie

                        Thanks, Wolfgang for your help and guidance

                        Its time to announce that i am able to see my application up and running on jboss-5.1

                         

                        Thanks..

                        • 10. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
                          tushar k Newbie

                          maltiYadav, good to read your application runs but can you explain what did you do which make your application run??

                          • 11. Re: jboss-5.1.0.GA. and Spring-3.0.5 gives linkage error with org.springframework.beans-3.0.5.RELEASE jar
                            Varun Saddi Newbie

                            Hello maltiYadav,

                             

                            I am also facing similar issue due to sax.jar. Could please explain how u resolved the issue at your end?