无法初始化类org.apache.cxf.staxutils.StaxUtils

时间:2013-10-21 09:15:06

标签: maven cxf spring-ws

我正在使用Spring / Maven开发一个应用程序,我遇到了依赖问题。一切正常,但当我向Spring-WS添加依赖时,我的测试停止了工作。

这是我的堆栈跟踪,导致无法加载ApplicationContext

Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.cxf.staxutils.StaxUtils
    at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:256)
    at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:203)
    at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:98)
    at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:199)
    at org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:147)
    at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:98)
    at javax.xml.ws.Service.<init>(Service.java:77)
    at com.mycompany.webservice.documentservice.client.DocumentServiceService.<init>(DocumentServiceService.java:61)
    at com.mycompany.service.implementation.DocumentService.<init>(DocumentService.java:121)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)

这是新的依赖项:

<!-- 
    Spring WS
-->
<dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-ws-core</artifactId>
    <version>${spring-ws.version}</version>
</dependency>
<dependency>
    <groupId>org.springframework.ws</groupId>
    <artifactId>spring-ws-security</artifactId>
    <version>${spring-ws.version}</version>
</dependency>

我认为与CXF依赖项存在冲突但无法找到:

<!-- 
    Web Service
-->
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-core</artifactId>
    <version>${cxf.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>${cxf.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-ws-security</artifactId>
    <version>${cxf.version}</version>
</dependency>

以下是冲突,但是当我添加排除时,问题仍然存在 Conflict with wsdl4j Conflict with wss4j

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

好的我通过执行以下操作解决了问题:

从CXF 2.7.6升级到2.7.7 添加依赖

<dependency>
    <groupId>com.sun.xml.stream</groupId>
    <artifactId>sjsxp</artifactId>
    <version>${sjsxp.version}</version>
</dependency>

无法解释原因,但测试运行良好,也是应用程序。