Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: NoClassDefFoundError: org/springframework/util/xml/StaxUtils

  1. #1
    Join Date
    Jan 2011
    Posts
    5

    Default NoClassDefFoundError: org/springframework/util/xml/StaxUtils

    Hello,

    I'm getting a "no class found" exceptions while trying to unmarshall XML with JAXB2 in my spring-ws service:

    Code:
    java.lang.NoClassDefFoundError: org/springframework/util/xml/StaxUtils
    	at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:577)
    	at org.springframework.oxm.jaxb.Jaxb2Marshaller.unmarshal(Jaxb2Marshaller.java:568)
    	at com.bnpparibasfortis.risk.training.ws.CreateNaturalPersonEndpoint.invokeInternal(CreateNaturalPersonEndpoint.java:36)
    ...
    Here is the relevant fragment of my spring-ws-servlet.xml:

    Code:
        <bean id="createNaturalPersonEndpoint" class="com.bnpparibasfortis.risk.training.ws.CreateNaturalPersonEndpoint">
            <property name="marshaller" ref="xmlMarshaller"/>
            <property name="unmarshaller" ref="xmlMarshaller"/>
            <property name="dao" ref="genericDao"/>
        </bean>
    
        <bean id="xmlMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <property name="classesToBeBound">
                <list>
                    <value>com.bnpparibasfortis.risk.training.xml.CreateNaturalPersonRequest</value>
                    <value>com.bnpparibasfortis.risk.training.xml.CreateNaturalPersonResponse</value>
                </list>
            </property>
        </bean>
    ...and an extract of my pom.xml:
    Code:
                    
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-oxm</artifactId>
                <version>3.0.5.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>2.5.6</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.ws</groupId>
                <artifactId>spring-ws-core</artifactId>
                <version>1.5.9</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>2.5.6</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>2.5.6</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>2.5.6</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring</artifactId>
                <version>2.5.6</version>
            </dependency>
    I have looked inside spring-2.5.6.jar and I see several classes in the org/springframework/util/xml folder (DomUtils, SimpleSaxErrorHandler, SimpleTransformErrorListener, TransformerUtils and XmlValidationModeDetector) but alas no StaxUtils.

    Help ?

    Jean-Louis

  2. #2
    Join Date
    Jan 2011
    Posts
    26

    Default Since 3.0

    StaxUtils seems to be introduced since 3.0 and is therefore not available in Spring 2.5.6. Try updating the version of spring-core to 3.0.5 in your pom.xml.

  3. #3
    Join Date
    Jan 2011
    Posts
    5

    Default

    Quote Originally Posted by vithun View Post
    StaxUtils seems to be introduced since 3.0 and is therefore not available in Spring 2.5.6. Try updating the version of spring-core to 3.0.5 in your pom.xml.
    Indeed, thanks !

    J-L

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Don't mix spring versions... Currently you are mixing 2.5 and 3.0 whereas spring-ws 1.5 doesn't work welll with spring 3 (due to the oxm stuff)..

    So either use 2.5 with spring-ws 1.5.x or use spring 3 with spring-ws 2.0.x..
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Jan 2011
    Posts
    5

    Default

    Quote Originally Posted by Marten Deinum View Post
    Don't mix spring versions... Currently you are mixing 2.5 and 3.0 whereas spring-ws 1.5 doesn't work welll with spring 3 (due to the oxm stuff)..

    So either use 2.5 with spring-ws 1.5.x or use spring 3 with spring-ws 2.0.x..
    With spring-ws 2.0.0-M1 I get an error I read about somewhere else on the web:

    Code:
    java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V
    	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:431)
    	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:459)
    OTOH, spring-oxm is available from Maven Central only starting at 3.0.*

    J-L

  6. #6
    Join Date
    Jan 2011
    Posts
    26

    Default

    The older versions of spring-oxm are available under org/springframework/ws/spring-oxm (http://repo2.maven.org/maven2/org/sp...ws/spring-oxm/). As suggested above, try not to mix up versions of spring jars, as it leads to missing dependencies.

  7. #7
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    Also Spring ws 2.0 is final and I suggest a read of this blog..

    But in general don't mix spring versions, that is trouble bound to happen. So as I stated either stay with your Spring ws 1.5 and spring 2.5 stack or use spring ws 2.0 and spring 3.0. Other combinations are troublesome.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  8. #8
    Join Date
    Jan 2011
    Posts
    5

    Default

    Thanks everybody, I got my dependencies right and it works now.

    J-L

  9. #9
    Join Date
    Feb 2011
    Location
    Australia, Canberra
    Posts
    3

    Default

    I am getting this same error with these dependencies.
    Any Ideas?

    Code:
    		<dependency>
    			<groupId>org.springframework.ws</groupId>
    			<artifactId>spring-ws-core</artifactId>
    			<version>2.0.0.RELEASE</version>			
    		</dependency>
    		
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-core</artifactId>
    			<version>3.0.5.RELEASE</version>
    		</dependency>

  10. #10
    Join Date
    Feb 2011
    Location
    Australia, Canberra
    Posts
    3

    Default

    Quote Originally Posted by databear View Post
    I am getting this same error with these dependencies.
    Any Ideas?

    Code:
    		<dependency>
    			<groupId>org.springframework.ws</groupId>
    			<artifactId>spring-ws-core</artifactId>
    			<version>2.0.0.RELEASE</version>			
    		</dependency>
    		
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-core</artifactId>
    			<version>3.0.5.RELEASE</version>
    		</dependency>
    sorry the error I am getting is this
    Code:
    Caused by: java.lang.NoSuchMethodError: org/springframework/util/xml/DomUtils.getChildElements(Lorg/w3c/dom/Element;)Ljava/util/List;
    	at org.springframework.ws.config.InterceptorsBeanDefinitionParser.parse(InterceptorsBeanDefinitionParser.java:49)
    	at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:73)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1335)
    	at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1325)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
    	at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:93)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:493)
    	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:390)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •