Maven 无法初始化类org.apache.cxf.staxutils.staxutils
我正在使用Spring/Maven开发一个应用程序,我遇到了一个依赖性问题。一切正常,但当我向SpringWS添加依赖项时,我的测试停止了工作 这是我的stacktrace,导致加载ApplicationContext失败Maven 无法初始化类org.apache.cxf.staxutils.staxutils,maven,cxf,spring-ws,Maven,Cxf,Spring Ws,我正在使用Spring/Maven开发一个应用程序,我遇到了一个依赖性问题。一切正常,但当我向SpringWS添加依赖项时,我的测试停止了工作 这是我的stacktrace,导致加载ApplicationContext失败 Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.apache.cxf.staxutils.StaxUtils at org.apache.cxf.wsdl11.WSDL
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)
原因:java.lang.NoClassDefFoundError:无法初始化类org.apache.cxf.staxutils.staxutils
位于org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:256)
位于org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:203)
位于org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:98)
位于org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:199)
位于org.apache.cxf.jaxws.serviceinpl.(serviceinpl.java:147)
位于org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:98)
位于javax.xml.ws.Service。(Service.java:77)
在com.mycompany.webservice.documentservice.client.DocumentServiceService.(DocumentServiceService.java:61)
位于com.mycompany.service.implementation.DocumentService。(DocumentService.java:121)
位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
位于sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
位于java.lang.reflect.Constructor.newInstance(Constructor.java:526)
位于org.springframework.beans.BeanUtils.InstanceClass(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>
org.springframework.ws
SpringWS核心
${spring ws.version}
org.springframework.ws
spring ws-security
${spring ws.version}
我认为与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>
org.apache.cxf
cxf rt核
${cxf.version}
org.apache.cxf
cxf rt前端jaxws
${cxf.version}
org.apache.cxf
cxf rt ws-security
${cxf.version}
下面是冲突,但当我添加排除时,问题仍然存在
谢谢您的帮助。好的,我通过执行以下操作解决了此问题: 从CXF 2.7.6升级到2.7.7 将依赖项添加到
<dependency>
<groupId>com.sun.xml.stream</groupId>
<artifactId>sjsxp</artifactId>
<version>${sjsxp.version}</version>
</dependency>
com.sun.xml.stream
sjsxp
${sjsxp.version}
无法解释原因,但测试运行良好,应用程序也运行良好。如果可以避免,您确实不想使用sjsxp。确保您已将woodstox core 4.2.0拉到某个地方。