开发者

Spring WS with JAXB2Marshaller - javax.activation.DataHandler NoClassDefFoundError

We are trying to implement a JAXB2Marshaller to our webservice project, but we get a java.lang.NoClassDefFoundError on the class javax.activation.DataHandler, however the depe开发者_如何学运维ndency to activation artifact exists and we have verified that the activation.jar is in fact being deployed, so this caused by something else.

Here is the app config:

<sws:annotation-driven />

    <sws:dynamic-wsdl id="security" portTypeName="security" locationUri="/">                               
        <sws:xsd location="classpath:security-service.xsd"/>                                                  
    </sws:dynamic-wsdl>

    <bean class="org.springframework.ws.server.endpoint.adapter.GenericMarshallingMethodEndpointAdapter">
        <constructor-arg ref="marshaller" />
    </bean>

    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="classesToBeBound" >
            <list>
                <value>com.app.model.SimpleRoleList</value>
            </list>
        </property>
        <property name="schema" value="classpath:types.xsd"/>
    </bean>

As always, help is really appreciated.

EDIT--------------

This only happens when the app is deployed to Tomcat 6.


     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-oxm</artifactId>
        <version>3.2.6.RELEASE</version>
    </dependency>

use this it will support for u


I just noticed I had older versions jaxb-api.jar and jaxb-impl.jar on the Tomcat's endorsed folder than the ones I'm using on the app. There are two ways of solving this; First one is to remove the jars from the endorsed folder and then add jaxb as a runtime dependency on the projects POM:

<dependency>
  <groupId>com.sun.xml.bind</groupId>
  <artifactId>jaxb-impl</artifactId>
  <version>2.2.2</version>
</dependency>

The second one is just to update the jars on the endorsed folder to newer versions (In my case its version 2.2.2).

That fixes it.

Hope its helpful to someone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜