CXFServlet throws java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
CXFServlet throws java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
我正在使用 Java 11、Spring Boot 2.1.1 和 Apache CXF 3.2.7 公开导入 XSD 架构的 SOAP Web 服务。在 WSDL 中它显示为:
<wsdl:import location="http://localhost:9000/endpoint/ws?wsdl=WS_endpointSoapPort.wsdl" namespace="http://test.com"> </wsdl:import>
当我发送查询时,它失败并显示以下堆栈:
2018-12-31 12:05:54,908 ERROR se.[Tomcat].[localhost].[/].[CXFServlet]: 175 - Servlet.service() for servlet [CXFServlet] in context with path [] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
有什么想法吗?
经过深入研究,我发现以下JIRA提到了Stax2版本的问题。顺便说一句,票据上说它可以解决我正在使用的版本。
最终,我升级到了woodstox-core-5.2.0。事实上,图书馆提到了那个版本中解决的类似问题。详情 here。
我目前的mvn dependency:tree
是:
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.1.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.1.1.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:5.1.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.1.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.1:compile
[INFO] | | | \- org.apache.logging.log4j:log4j-api:jar:2.11.1:compile
[INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | +- org.springframework:spring-core:jar:5.1.3.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.1.3.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.1.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.7:compile
[INFO] | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.7:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.7:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.7:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.7:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.1.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.13:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.13:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.13:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.13.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.4.0:compile
[INFO] | +- org.springframework:spring-web:jar:5.1.3.RELEASE:compile
[INFO] | | \- org.springframework:spring-beans:jar:5.1.3.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.1.3.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.1.3.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.1.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.1.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.1.1.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.1.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:3.11.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.9.5:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.9.5:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.1.3.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.2:test
[INFO] +- org.apache.cxf:cxf-spring-boot-starter-jaxws:jar:3.2.7:compile
[INFO] | +- org.apache.cxf:cxf-spring-boot-autoconfigure:jar:3.2.7:compile
[INFO] | +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:3.2.7:compile
[INFO] | | +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] | | +- org.ow2.asm:asm:jar:6.2:compile
[INFO] | | +- org.apache.cxf:cxf-rt-bindings-xml:jar:3.2.7:compile
[INFO] | | +- org.apache.cxf:cxf-rt-frontend-simple:jar:3.2.7:compile
[INFO] | | \- org.apache.cxf:cxf-rt-ws-addr:jar:3.2.7:compile
[INFO] | | \- org.apache.cxf:cxf-rt-ws-policy:jar:3.2.7:compile
[INFO] | \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] +- com.fasterxml.woodstox:woodstox-core:jar:5.2.0:compile
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:4.1:compile
[INFO] +- org.apache.cxf:cxf-rt-transports-http:jar:3.2.7:compile
[INFO] | \- org.apache.cxf:cxf-core:jar:3.2.7:compile
[INFO] | \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.3:compile
[INFO] +- org.apache.cxf:cxf-rt-ws-security:jar:3.2.7:compile
[INFO] | +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.2.7:compile
[INFO] | | +- org.apache.cxf:cxf-rt-wsdl:jar:3.2.7:compile
[INFO] | | | \- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] | | \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:3.2.7:compile
[INFO] | +- org.apache.cxf:cxf-rt-security-saml:jar:3.2.7:compile
[INFO] | | \- org.apache.cxf:cxf-rt-security:jar:3.2.7:compile
[INFO] | +- net.sf.ehcache:ehcache:jar:2.10.6:compile
[INFO] | +- org.apache.wss4j:wss4j-ws-security-dom:jar:2.2.2:compile
[INFO] | | \- org.apache.wss4j:wss4j-ws-security-common:jar:2.2.2:compile
[INFO] | | +- org.apache.santuario:xmlsec:jar:2.1.2:compile
[INFO] | | | \- commons-codec:commons-codec:jar:1.11:compile
[INFO] | | +- org.opensaml:opensaml-saml-impl:jar:3.3.0:compile
[INFO] | | | +- org.opensaml:opensaml-profile-api:jar:3.3.0:compile
[INFO] | | | | \- org.opensaml:opensaml-core:jar:3.3.0:compile
[INFO] | | | | \- io.dropwizard.metrics:metrics-core:jar:4.0.3:compile
[INFO] | | | +- org.opensaml:opensaml-saml-api:jar:3.3.0:compile
[INFO] | | | | +- org.opensaml:opensaml-xmlsec-api:jar:3.3.0:compile
[INFO] | | | | \- org.opensaml:opensaml-soap-api:jar:3.3.0:compile
[INFO] | | | +- org.opensaml:opensaml-security-impl:jar:3.3.0:compile
[INFO] | | | | \- org.opensaml:opensaml-security-api:jar:3.3.0:compile
[INFO] | | | | +- org.cryptacular:cryptacular:jar:1.1.1:compile
[INFO] | | | | \- org.bouncycastle:bcprov-jdk15on:jar:1.54:compile
[INFO] | | | +- org.opensaml:opensaml-xmlsec-impl:jar:3.3.0:compile
[INFO] | | | \- net.shibboleth.utilities:java-support:jar:7.3.0:compile
[INFO] | | | +- com.google.guava:guava:jar:19.0:compile
[INFO] | | | \- joda-time:joda-time:jar:2.10.1:compile
[INFO] | | +- org.opensaml:opensaml-xacml-impl:jar:3.3.0:compile
[INFO] | | | \- org.opensaml:opensaml-xacml-api:jar:3.3.0:compile
[INFO] | | +- org.opensaml:opensaml-xacml-saml-impl:jar:3.3.0:compile
[INFO] | | | \- org.opensaml:opensaml-xacml-saml-api:jar:3.3.0:compile
[INFO] | | +- org.jasypt:jasypt:jar:1.9.2:compile
[INFO] | | \- org.apache.geronimo.javamail:geronimo-javamail_1.4_mail:jar:1.8.4:compile
[INFO] | +- org.apache.wss4j:wss4j-policy:jar:2.2.2:compile
[INFO] | | \- org.apache.neethi:neethi:jar:3.1.1:compile
[INFO] | | \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | +- org.apache.wss4j:wss4j-ws-security-stax:jar:2.2.2:compile
[INFO] | | \- org.apache.wss4j:wss4j-bindings:jar:2.2.2:compile
[INFO] | \- org.apache.wss4j:wss4j-ws-security-policy-stax:jar:2.2.2:compile
[INFO] +- org.apache.cxf:cxf-rt-features-logging:jar:3.2.7:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.8.1:compile
[INFO] +- org.glassfish.jaxb:jaxb-runtime:jar:2.4.0-b180830.0438:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.4.0-b180830.0438:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.7:compile
[INFO] | +- org.jvnet.staxex:stax-ex:jar:1.8:compile
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.15:compile
[INFO] | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- com.sun.xml.ws:jaxws-rt:pom:2.3.1:compile
[INFO] | +- javax.xml.ws:jaxws-api:jar:2.3.1:compile
[INFO] | +- javax.xml.soap:javax.xml.soap-api:jar:1.4.0:compile
[INFO] | +- javax.jws:javax.jws-api:jar:1.1:compile
[INFO] | +- com.sun.xml.ws:policy:jar:2.7.5:compile
[INFO] | | \- com.sun.activation:javax.activation:jar:1.2.0:compile
[INFO] | +- org.glassfish.gmbal:gmbal-api-only:jar:3.1.0-b001:compile
[INFO] | | \- org.glassfish.external:management-api:jar:3.0.0-b012:compile
[INFO] | +- com.sun.xml.stream.buffer:streambuffer:jar:1.5.6:compile
[INFO] | +- org.jvnet.mimepull:mimepull:jar:1.9.10:compile
[INFO] | +- org.glassfish.ha:ha-api:jar:3.1.9:compile
[INFO] | \- com.sun.xml.messaging.saaj:saaj-impl:jar:1.5.0:compile
[INFO] \- com.sun.xml.ws:rt:jar:2.3.1:compile
我 运行 遇到同样的问题并升级到 CXF 3.2.7 或更高版本为我解决了这个问题。
我在 org.codehaus.woodstox:stax2-api
上有冲突,它包含在 org.apache.cxf:cxf-core
的 3.1.4 版和 com.sun.xml.ws:rt
的 4.1 版中。我通过使用 Maven excludes:
删除库解决了冲突
<exclusions>
<exclusion>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId><!-- 4.1 conflicts with 3.1.4 from apache cxf-spring-boot-starter-jaxws-->
</exclusion>
</exclusions>
我在使用不同版本的 stax2-api 的 Maven 中的某些依赖项时遇到了同样的问题。
Maven 编译器只使用一个版本的 stax2-api(在我的例子中它是最新的),所以我尝试包含版本 3.1.4 和 4.2.1(其他 jar 需要)使用 运行时范围
这是 pom.xml
的片段
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>4.2.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>3.1.4</version>
<scope>runtime</scope>
</dependency>
REMARKS:在我的例子中,它在将 class 作为 java 应用程序 执行时有效,但是在 web 应用程序 环境 (Tomcat)!
中执行时不起作用
密钥可能在您的 mvn:dependency-tree
输出中。就我而言:
[INFO] \- org.apache.cxf:cxf-rt-ws-security:jar:3.3.6:compile
[INFO] +- org.apache.cxf:cxf-core:jar:3.3.6:compile
[INFO] | \- com.fasterxml.woodstox:woodstox-core:jar:5.3.0:compile (version managed from 5.0.3)
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:4.2:compile
[INFO] \- org.apache.wss4j:wss4j-policy:jar:2.2.5:compile
[INFO] \- org.apache.neethi:neethi:jar:3.1.1:compile
[INFO] \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] \- (org.codehaus.woodstox:stax2-api:jar:3.1.4:compile - omitted for conflict with 4.2)
org.apache.cxf:cxf-rt-ws-security:jar:3.3.6
导致 stax2-api 版本 3.1.4 和版本 4.2 因为非常过时的 woodstox-core-asl
依赖项(从 2014 年开始)。我将不得不看看是否可以摆脱它,因为它会导致上述 NoSuchMethodFoundError。
我正在使用 Java 11、Spring Boot 2.1.1 和 Apache CXF 3.2.7 公开导入 XSD 架构的 SOAP Web 服务。在 WSDL 中它显示为:
<wsdl:import location="http://localhost:9000/endpoint/ws?wsdl=WS_endpointSoapPort.wsdl" namespace="http://test.com"> </wsdl:import>
当我发送查询时,它失败并显示以下堆栈:
2018-12-31 12:05:54,908 ERROR se.[Tomcat].[localhost].[/].[CXFServlet]: 175 - Servlet.service() for servlet [CXFServlet] in context with path [] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoSuchMethodError: org.codehaus.stax2.ri.EmptyIterator.getInstance()Lorg/codehaus/stax2/ri/EmptyIterator;
有什么想法吗?
经过深入研究,我发现以下JIRA提到了Stax2版本的问题。顺便说一句,票据上说它可以解决我正在使用的版本。
最终,我升级到了woodstox-core-5.2.0。事实上,图书馆提到了那个版本中解决的类似问题。详情 here。
我目前的mvn dependency:tree
是:
[INFO] +- org.springframework.boot:spring-boot-starter:jar:2.1.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot:jar:2.1.1.RELEASE:compile
[INFO] | | \- org.springframework:spring-context:jar:5.1.3.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-logging:jar:2.1.1.RELEASE:compile
[INFO] | | +- ch.qos.logback:logback-classic:jar:1.2.3:compile
[INFO] | | | \- ch.qos.logback:logback-core:jar:1.2.3:compile
[INFO] | | +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.1:compile
[INFO] | | | \- org.apache.logging.log4j:log4j-api:jar:2.11.1:compile
[INFO] | | \- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] | +- javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] | +- org.springframework:spring-core:jar:5.1.3.RELEASE:compile
[INFO] | | \- org.springframework:spring-jcl:jar:5.1.3.RELEASE:compile
[INFO] | \- org.yaml:snakeyaml:jar:1.23:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-web:jar:2.1.1.RELEASE:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-json:jar:2.1.1.RELEASE:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.7:compile
[INFO] | | | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
[INFO] | | | \- com.fasterxml.jackson.core:jackson-core:jar:2.9.7:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.7:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.7:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.7:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-tomcat:jar:2.1.1.RELEASE:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.13:compile
[INFO] | | +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.13:compile
[INFO] | | \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.13:compile
[INFO] | +- org.hibernate.validator:hibernate-validator:jar:6.0.13.Final:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
[INFO] | | \- com.fasterxml:classmate:jar:1.4.0:compile
[INFO] | +- org.springframework:spring-web:jar:5.1.3.RELEASE:compile
[INFO] | | \- org.springframework:spring-beans:jar:5.1.3.RELEASE:compile
[INFO] | \- org.springframework:spring-webmvc:jar:5.1.3.RELEASE:compile
[INFO] | +- org.springframework:spring-aop:jar:5.1.3.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:5.1.3.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-autoconfigure:jar:2.1.1.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.1.1.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test:jar:2.1.1.RELEASE:test
[INFO] | +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.1.RELEASE:test
[INFO] | +- com.jayway.jsonpath:json-path:jar:2.4.0:test
[INFO] | | \- net.minidev:json-smart:jar:2.3:test
[INFO] | | \- net.minidev:accessors-smart:jar:1.2:test
[INFO] | +- junit:junit:jar:4.12:test
[INFO] | +- org.assertj:assertj-core:jar:3.11.1:test
[INFO] | +- org.mockito:mockito-core:jar:2.23.4:test
[INFO] | | +- net.bytebuddy:byte-buddy:jar:1.9.5:test
[INFO] | | +- net.bytebuddy:byte-buddy-agent:jar:1.9.5:test
[INFO] | | \- org.objenesis:objenesis:jar:2.6:test
[INFO] | +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] | +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] | +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] | | \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] | +- org.springframework:spring-test:jar:5.1.3.RELEASE:test
[INFO] | \- org.xmlunit:xmlunit-core:jar:2.6.2:test
[INFO] +- org.apache.cxf:cxf-spring-boot-starter-jaxws:jar:3.2.7:compile
[INFO] | +- org.apache.cxf:cxf-spring-boot-autoconfigure:jar:3.2.7:compile
[INFO] | +- org.apache.cxf:cxf-rt-frontend-jaxws:jar:3.2.7:compile
[INFO] | | +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] | | +- org.ow2.asm:asm:jar:6.2:compile
[INFO] | | +- org.apache.cxf:cxf-rt-bindings-xml:jar:3.2.7:compile
[INFO] | | +- org.apache.cxf:cxf-rt-frontend-simple:jar:3.2.7:compile
[INFO] | | \- org.apache.cxf:cxf-rt-ws-addr:jar:3.2.7:compile
[INFO] | | \- org.apache.cxf:cxf-rt-ws-policy:jar:3.2.7:compile
[INFO] | \- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] +- com.fasterxml.woodstox:woodstox-core:jar:5.2.0:compile
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:4.1:compile
[INFO] +- org.apache.cxf:cxf-rt-transports-http:jar:3.2.7:compile
[INFO] | \- org.apache.cxf:cxf-core:jar:3.2.7:compile
[INFO] | \- org.apache.ws.xmlschema:xmlschema-core:jar:2.2.3:compile
[INFO] +- org.apache.cxf:cxf-rt-ws-security:jar:3.2.7:compile
[INFO] | +- org.apache.cxf:cxf-rt-bindings-soap:jar:3.2.7:compile
[INFO] | | +- org.apache.cxf:cxf-rt-wsdl:jar:3.2.7:compile
[INFO] | | | \- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] | | \- org.apache.cxf:cxf-rt-databinding-jaxb:jar:3.2.7:compile
[INFO] | +- org.apache.cxf:cxf-rt-security-saml:jar:3.2.7:compile
[INFO] | | \- org.apache.cxf:cxf-rt-security:jar:3.2.7:compile
[INFO] | +- net.sf.ehcache:ehcache:jar:2.10.6:compile
[INFO] | +- org.apache.wss4j:wss4j-ws-security-dom:jar:2.2.2:compile
[INFO] | | \- org.apache.wss4j:wss4j-ws-security-common:jar:2.2.2:compile
[INFO] | | +- org.apache.santuario:xmlsec:jar:2.1.2:compile
[INFO] | | | \- commons-codec:commons-codec:jar:1.11:compile
[INFO] | | +- org.opensaml:opensaml-saml-impl:jar:3.3.0:compile
[INFO] | | | +- org.opensaml:opensaml-profile-api:jar:3.3.0:compile
[INFO] | | | | \- org.opensaml:opensaml-core:jar:3.3.0:compile
[INFO] | | | | \- io.dropwizard.metrics:metrics-core:jar:4.0.3:compile
[INFO] | | | +- org.opensaml:opensaml-saml-api:jar:3.3.0:compile
[INFO] | | | | +- org.opensaml:opensaml-xmlsec-api:jar:3.3.0:compile
[INFO] | | | | \- org.opensaml:opensaml-soap-api:jar:3.3.0:compile
[INFO] | | | +- org.opensaml:opensaml-security-impl:jar:3.3.0:compile
[INFO] | | | | \- org.opensaml:opensaml-security-api:jar:3.3.0:compile
[INFO] | | | | +- org.cryptacular:cryptacular:jar:1.1.1:compile
[INFO] | | | | \- org.bouncycastle:bcprov-jdk15on:jar:1.54:compile
[INFO] | | | +- org.opensaml:opensaml-xmlsec-impl:jar:3.3.0:compile
[INFO] | | | \- net.shibboleth.utilities:java-support:jar:7.3.0:compile
[INFO] | | | +- com.google.guava:guava:jar:19.0:compile
[INFO] | | | \- joda-time:joda-time:jar:2.10.1:compile
[INFO] | | +- org.opensaml:opensaml-xacml-impl:jar:3.3.0:compile
[INFO] | | | \- org.opensaml:opensaml-xacml-api:jar:3.3.0:compile
[INFO] | | +- org.opensaml:opensaml-xacml-saml-impl:jar:3.3.0:compile
[INFO] | | | \- org.opensaml:opensaml-xacml-saml-api:jar:3.3.0:compile
[INFO] | | +- org.jasypt:jasypt:jar:1.9.2:compile
[INFO] | | \- org.apache.geronimo.javamail:geronimo-javamail_1.4_mail:jar:1.8.4:compile
[INFO] | +- org.apache.wss4j:wss4j-policy:jar:2.2.2:compile
[INFO] | | \- org.apache.neethi:neethi:jar:3.1.1:compile
[INFO] | | \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | +- org.apache.wss4j:wss4j-ws-security-stax:jar:2.2.2:compile
[INFO] | | \- org.apache.wss4j:wss4j-bindings:jar:2.2.2:compile
[INFO] | \- org.apache.wss4j:wss4j-ws-security-policy-stax:jar:2.2.2:compile
[INFO] +- org.apache.cxf:cxf-rt-features-logging:jar:3.2.7:compile
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- org.apache.commons:commons-lang3:jar:3.8.1:compile
[INFO] +- org.glassfish.jaxb:jaxb-runtime:jar:2.4.0-b180830.0438:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.3.1:compile
[INFO] | +- org.glassfish.jaxb:txw2:jar:2.4.0-b180830.0438:compile
[INFO] | +- com.sun.istack:istack-commons-runtime:jar:3.0.7:compile
[INFO] | +- org.jvnet.staxex:stax-ex:jar:1.8:compile
[INFO] | +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.15:compile
[INFO] | \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- com.sun.xml.ws:jaxws-rt:pom:2.3.1:compile
[INFO] | +- javax.xml.ws:jaxws-api:jar:2.3.1:compile
[INFO] | +- javax.xml.soap:javax.xml.soap-api:jar:1.4.0:compile
[INFO] | +- javax.jws:javax.jws-api:jar:1.1:compile
[INFO] | +- com.sun.xml.ws:policy:jar:2.7.5:compile
[INFO] | | \- com.sun.activation:javax.activation:jar:1.2.0:compile
[INFO] | +- org.glassfish.gmbal:gmbal-api-only:jar:3.1.0-b001:compile
[INFO] | | \- org.glassfish.external:management-api:jar:3.0.0-b012:compile
[INFO] | +- com.sun.xml.stream.buffer:streambuffer:jar:1.5.6:compile
[INFO] | +- org.jvnet.mimepull:mimepull:jar:1.9.10:compile
[INFO] | +- org.glassfish.ha:ha-api:jar:3.1.9:compile
[INFO] | \- com.sun.xml.messaging.saaj:saaj-impl:jar:1.5.0:compile
[INFO] \- com.sun.xml.ws:rt:jar:2.3.1:compile
我 运行 遇到同样的问题并升级到 CXF 3.2.7 或更高版本为我解决了这个问题。
我在 org.codehaus.woodstox:stax2-api
上有冲突,它包含在 org.apache.cxf:cxf-core
的 3.1.4 版和 com.sun.xml.ws:rt
的 4.1 版中。我通过使用 Maven excludes:
<exclusions>
<exclusion>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId><!-- 4.1 conflicts with 3.1.4 from apache cxf-spring-boot-starter-jaxws-->
</exclusion>
</exclusions>
我在使用不同版本的 stax2-api 的 Maven 中的某些依赖项时遇到了同样的问题。
Maven 编译器只使用一个版本的 stax2-api(在我的例子中它是最新的),所以我尝试包含版本 3.1.4 和 4.2.1(其他 jar 需要)使用 运行时范围
这是 pom.xml
的片段<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>4.2.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>3.1.4</version>
<scope>runtime</scope>
</dependency>
REMARKS:在我的例子中,它在将 class 作为 java 应用程序 执行时有效,但是在 web 应用程序 环境 (Tomcat)!
中执行时不起作用密钥可能在您的 mvn:dependency-tree
输出中。就我而言:
[INFO] \- org.apache.cxf:cxf-rt-ws-security:jar:3.3.6:compile
[INFO] +- org.apache.cxf:cxf-core:jar:3.3.6:compile
[INFO] | \- com.fasterxml.woodstox:woodstox-core:jar:5.3.0:compile (version managed from 5.0.3)
[INFO] | \- org.codehaus.woodstox:stax2-api:jar:4.2:compile
[INFO] \- org.apache.wss4j:wss4j-policy:jar:2.2.5:compile
[INFO] \- org.apache.neethi:neethi:jar:3.1.1:compile
[INFO] \- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] \- (org.codehaus.woodstox:stax2-api:jar:3.1.4:compile - omitted for conflict with 4.2)
org.apache.cxf:cxf-rt-ws-security:jar:3.3.6
导致 stax2-api 版本 3.1.4 和版本 4.2 因为非常过时的 woodstox-core-asl
依赖项(从 2014 年开始)。我将不得不看看是否可以摆脱它,因为它会导致上述 NoSuchMethodFoundError。