Announcement Announcement Module
Collapse
No announcement yet.
Classloader problems after upgrade - NamespaceHandler interface Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Classloader problems after upgrade - NamespaceHandler interface

    After upgrading to Spring 2.5, I started receiving the exception below when when initializing the context.

    I have placed spring.jar and spring-webmvc.jar in the %CATALINA_HOME%/common/lib directory. I also copied the 3rd-party JARs from the Spring download into this directory.

    The only other JAR files on the classpath are fop.jar, Verisign.jar and openjms-client-0.7.6.jar.

    I'm pretty sure this is a classloader issue...but I can't figure out which JAR file is causing the conflict.

    What is the best way to figure out which JAR is causing the problem? I'm totally stuck here!

    java.lang.IllegalArgumentException: Class [org.springframework.jms.config.JmsNamespaceHandler] does not implement the NamespaceHandler interface

    Code:
    2007-11-26 14:10:52,000 DEBUG [main] (DefaultNamespaceHandlerResolver.java: initHandlerMappings() :110) - Loaded mappings [{http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, http://www.springframework.org/schema/jms=org.springframework.jms.config.JmsNamespaceHandler, http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler, http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler}]
    2007-11-26 14:10:52,203 ERROR [main] (ContextLoader.java: initWebApplicationContext() :205) - Context initialization failed
    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/classes/applicationContext-jdbc.xml]; nested exception is java.lang.IllegalArgumentException: Class [org.springframework.jms.config.JmsNamespaceHandler] does not implement the NamespaceHandler interface
    Caused by: 
    java.lang.IllegalArgumentException: Class [org.springframework.jms.config.JmsNamespaceHandler] does not implement the NamespaceHandler interface
    	at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.initHandlerMappings(DefaultNamespaceHandlerResolver.java:119)
    	at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.<init>(DefaultNamespaceHandlerResolver.java:96)
    	at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.<init>(DefaultNamespaceHandlerResolver.java:82)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.createDefaultNamespaceHandlerResolver(XmlBeanDefinitionReader.java:530)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.createReaderContext(XmlBeanDefinitionReader.java:519)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:499)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:407)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:357)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
    	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
    	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:123)
    	at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:91)
    	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:94)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:294)
    	at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
    	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
    	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)

  • #2
    Make sure there isn't another spring.jar (or another spring.jar) in your WEB-INF/lib. I also wouldn't put the spring jars in the common/lib directory but in the WEB-INF/lib directory.

    Comment


    • #3
      JAR files in %CATALINA_HOME%/common/lib

      I definitely don't have any other versions of spring.jar hiding anywhere.

      The reason I put the spring.jar file in the Tomcat common directory is b/c we have multiple webapps running on the same server that all require spring.jar. I was under the impression that it was better to share the same jars rather than risk multiple WAR files having conflicting jars.

      Why would I want to have multiple WAR files deployed, all of them containing the same jar files? Does it matter?

      Comment


      • #4
        I definitely don't have any other versions of spring.jar hiding anywhere.
        Well you have one hidden somewhere, hence the error message.

        The reason I put the spring.jar file in the Tomcat common directory is b/c we have multiple webapps running on the same server that all require spring.jar. I was under the impression that it was better to share the same jars rather than risk multiple WAR files having conflicting jars.
        If you are sure each applications needs spring 2.5 and that each application has libraries which work with spring 2.5. If you are certain of this you can do this. I had multiple issues with jars in common/lib so I tend to put them in the applications war (i also tend to use the separate jar files instead of the large spring.jar).

        Comment


        • #5
          Did you check to see if you have a CLASSPATH variable referring to an older version of Spring?

          Comment


          • #6
            Originally posted by wufpack00 View Post
            I was under the impression that it was better to share the same jars rather than risk multiple WAR files having conflicting jars.
            So by trying to avoid a problem you actually introduce one

            The idea about web applications is exactly to have classloader isolation and NO conflicts between two applications. By moving classes to the common classloader you give up on this idea. This should really only be done if it is necessary as with a common Spring application context for all the web applications for example.

            Joerg

            Comment


            • #7
              Successfully deplloyed pixweb app

              I moved the spring.jar to the pixweb-0.0.1/WEB-INF/lib folder and I can view the PixWeb store.

              Thanks!

              Comment


              • #8
                This is definitely a classloading problem. I solved it by checking through my classpath and removing a spring.jar with an old version (pre 2.5).

                Comment

                Working...
                X