2013-10-21 359 views
0

我正在開發一個使用Spring/Maven的應用程序,並且遇到依賴關係的問題。一切正常,但是當我向Spring-WS添加依賴時,我的測試停止工作。無法初始化類org.apache.cxf.staxutils.StaxUtils

這裏是堆棧跟蹤我,導致無法加載的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

感謝您的幫助。

回答

0

好吧,我通過以下操作解決了該問題:從CXF 2.7.6

升級到2.7.7 加入依賴性

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

無法解釋爲什麼,但測試運行良好,該應用程序也是。

+1

如果你完全可以避免它,你真的不想使用sjsxp。確保你在某處放置了woodstox-core 4.2.0。 –

相關問題