问题描述
我有一个Java类负责连接到Web服务以验证证书,这种情况是,当我采取措施调用WS时,它返回以下错误:java.lang.NoSuchMethodError:org.apache.xml.security.transforms.Transform.init()V
I have a java class in charge of connecting to a web services to validate a certificate, the case is that when I take steps to invoke WS, it returns the following error:java.lang.NoSuchMethodError: org.apache.xml.security.transforms.Transform.init () V
我已经尝试删除库,但是它不起作用.
I've tried deleting libraries but it does not work.
我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.onelogin</groupId>
<artifactId>java-saml-tookit-samples</artifactId>
<version>2.0.1</version>
</parent>
<artifactId>samlAutentica</artifactId>
<packaging>war</packaging>
<name>samlAutentica</name>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.onelogin</groupId>
<artifactId>java-saml</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxrpc-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-cas</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>1.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.7.5</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1-beta-6</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.4</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.3.RELEASE</version>
</dependency>
<dependency>
<groupId>com.liferay</groupId>
<artifactId>nl.captcha.simplecaptcha</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.webflow</groupId>
<artifactId>spring-webflow</artifactId>
<version>2.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.santuario</groupId>
<artifactId>xmlsec</artifactId>
<version>1.5.8</version>
</dependency>
</dependencies>
StackTrace
StackTrace
java.lang.NoSuchMethodError:
org.apache.xml.security.transforms.Transform.init()V
org.apache.ws.security.WSSConfig.staticInit(WSSConfig.java:253)
org.apache.ws.security.WSSConfig.<init>(WSSConfig.java:269)
org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:278)
org.apache.ws.security.WSSConfig.getDefaultWSConfig(WSSConfig.java:287)
org.apache.ws.security.message.WSSecBase.<init>(WSSecBase.java:47)
org.apache.ws.security.message.WSSecSignature.<init>
(WSSecSignature.java:126)
es.sag.autentica.afirma.ClientHandler.createBinarySecurityToken(ClientHandle
r.java:209)
es.sag.autentica.afirma.ClientHandler.invoke(ClientHandler.java:107)
org.apache.axis.client.AxisClient.invoke(AxisClient.java:121)
org.apache.axis.client.Call.invokeEngine(Call.java:2784)
org.apache.axis.client.Call.invoke(Call.java:2767)
org.apache.axis.client.Call.invoke(Call.java:2443)
org.apache.axis.client.Call.invoke(Call.java:2366)
org.apache.axis.client.Call.invoke(Call.java:1812)
es.sag.autentica.afirma.RequestConstructor.invokeWS(RequestConstructor.java:
175)
es.sag.autentica.afirma.certificado.Certificado.<init>(Certificado.java:105)
es.sag.autentica.saml.utils.Utility.validateCertificate(Utility.java:783)
org.apache.jsp.index_jsp._jspService(index_jsp.java:130)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:4
43)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
谢谢!
推荐答案
正如我在第一句话中建议的那样.您有冲突的jars xmlsec.jar
作为从具有许多不同版本(我算过3个版本)的jars的依赖项导入到您的项目中.在所有三个版本中,最终选择了版本1.5.6
之一,这是缺少wss4j.jar:1.5.6
调用的init()
方法的版本.
As I suggested you in my first comment. You have conflicting jars xmlsec.jar
is imported to your project as dependency from other jars with many different versions (I counted 3 versions). Of all 3 versions the one of version 1.5.6
is finally selected and this is the one which lacks the init()
method that wss4j.jar:1.5.6
calls.
这可以通过在maven中调用依赖树来观察,我将结果发布在这里:
This can be observed by calling the dependency tree in maven, I am posting you the results here:
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.onelogin:samlAutentica:war:2.0.1
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework.ldap:spring-ldap-core:jar -> version 2.3.1.RELEASE vs 1.3.1.RELEASE @ line 165, column 17
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework:spring-webmvc:jar -> version 3.1.2.RELEASE vs 3.0.3.RELEASE @ line 215, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building samlAutentica 2.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ samlAutentica ---
[INFO] com.onelogin:samlAutentica:war:2.0.1
[INFO] +- com.onelogin:java-saml:jar:2.0.1:compile
[INFO] | +- com.onelogin:java-saml-core:jar:2.0.1:compile
[INFO] | | +- (org.slf4j:slf4j-api:jar:1.7.12:compile - version managed from 1.7.14; omitted for duplicate)
[INFO] | | +- (joda-time:joda-time:jar:2.9.4:compile - omitted for duplicate)
[INFO] | | +- (org.apache.commons:commons-lang3:jar:3.4:compile - omitted for duplicate)
[INFO] | | +- (org.apache.santuario:xmlsec:jar:2.0.7:compile - omitted for duplicate)
[INFO] | | \- (commons-codec:commons-codec:jar:1.10:compile - omitted for duplicate)
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.12:compile
[INFO] | +- joda-time:joda-time:jar:2.9.4:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.4:compile
[INFO] | +- (org.apache.santuario:xmlsec:jar:2.0.7:compile - omitted for conflict with 1.5.8)
[INFO] | \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- org.apache.axis:axis:jar:1.4:compile
[INFO] +- log4j:log4j:jar:1.2.15:provided (scope not updated to compile)
[INFO] | \- (javax.mail:mail:jar:1.4:provided - omitted for duplicate)
[INFO] +- org.apache.logging.log4j:log4j-1.2-api:jar:2.3:compile
[INFO] | +- org.apache.logging.log4j:log4j-api:jar:2.3:compile
[INFO] | \- org.apache.logging.log4j:log4j-core:jar:2.3:compile
[INFO] | \- (org.apache.logging.log4j:log4j-api:jar:2.3:compile - omitted for duplicate)
[INFO] +- org.apache.ws.security:wss4j:jar:1.5.6:compile
[INFO] | +- commons-logging:commons-logging:jar:1.1:compile
[INFO] | | +- (log4j:log4j:jar:1.2.12:compile - omitted for conflict with 1.2.15)
[INFO] | | +- logkit:logkit:jar:1.0.1:compile
[INFO] | | +- avalon-framework:avalon-framework:jar:4.1.3:compile
[INFO] | | \- (javax.servlet:servlet-api:jar:2.3:compile - omitted for conflict with 2.5)
[INFO] | +- (org.apache.santuario:xmlsec:jar:1.4.2:compile - omitted for conflict with 2.0.7)
[INFO] | +- xalan:xalan:jar:2.7.1:compile
[INFO] | | \- xalan:serializer:jar:2.7.1:compile
[INFO] | | \- (xml-apis:xml-apis:jar:1.3.04:compile - omitted for conflict with 1.0.b2)
[INFO] | \- bouncycastle:bcprov-jdk14:jar:140:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided (scope not updated to compile)
[INFO] +- org.springframework.ldap:spring-ldap-core:jar:1.3.1.RELEASE:compile
[INFO] | +- (commons-logging:commons-logging:jar:1.0.4:compile - omitted for conflict with 1.1)
[INFO] | +- (commons-lang:commons-lang:jar:2.5:compile - omitted for conflict with 2.6)
[INFO] | +- (org.springframework:spring-core:jar:3.0.5.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- (org.springframework:spring-beans:jar:3.0.5.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | \- org.springframework:spring-tx:jar:3.0.5.RELEASE:compile
[INFO] | +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-aop:jar:3.0.5.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- (org.springframework:spring-beans:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.0.5.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
[INFO] | \- (org.springframework:spring-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] +- javax.xml:jaxrpc-api:jar:1.1:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- org.jdom:jdom:jar:1.1:compile
[INFO] +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] +- org.springframework.security:spring-security-cas:jar:3.1.0.RELEASE:compile
[INFO] | +- (org.springframework.security:spring-security-web:jar:3.1.0.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | +- org.jasig.cas.client:cas-client-core:jar:3.1.12:compile
[INFO] | | \- (commons-logging:commons-logging:jar:1.1:compile - omitted for duplicate)
[INFO] | +- org.springframework:spring-web:jar:3.0.6.RELEASE:compile
[INFO] | | +- (aopalliance:aopalliance:jar:1.0:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | | +- (org.springframework:spring-context:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | | \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | +- (org.springframework.security:spring-security-core:jar:3.1.0.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | +- (org.springframework:spring-context:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- (org.springframework:spring-beans:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | \- (org.springframework:spring-core:jar:3.0.6.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] +- org.springframework.security:spring-security-config:jar:3.0.5.RELEASE:compile
[INFO] | \- (org.springframework.security:spring-security-core:jar:3.0.5.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
[INFO] +- org.springframework.security:spring-security-core:jar:3.0.5.RELEASE:compile
[INFO] | +- (org.springframework:spring-expression:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | +- (org.springframework:spring-context:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
[INFO] | +- (org.springframework:spring-tx:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | +- (org.springframework:spring-aop:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- org.aspectj:aspectjrt:jar:1.6.8:compile
[INFO] | \- org.aspectj:aspectjweaver:jar:1.6.8:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:3.0.5.RELEASE:compile
[INFO] | +- (org.springframework.security:spring-security-web:jar:3.0.5.RELEASE:compile - omitted for conflict with 3.1.0.RELEASE)
[INFO] | +- org.springframework.security:spring-security-acl:jar:3.0.5.RELEASE:compile
[INFO] | | +- (org.springframework.security:spring-security-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-context-support:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | | \- (org.springframework:spring-jdbc:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
[INFO] | \- (org.springframework:spring-web:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
[INFO] +- org.springframework.security:spring-security-web:jar:3.0.5.RELEASE:compile
[INFO] | +- (org.springframework.security:spring-security-core:jar:3.0.5.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-web:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
[INFO] +- org.springframework:spring-aop:jar:3.0.3.RELEASE:compile
[INFO] | +- aopalliance:aopalliance:jar:1.0:compile
[INFO] | +- (org.springframework:spring-asm:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | \- (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] +- org.springframework:spring-asm:jar:3.0.3.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:3.0.3.RELEASE:compile
[INFO] | \- (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] +- org.springframework:spring-context:jar:3.0.3.RELEASE:compile
[INFO] | +- (org.springframework:spring-aop:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] | +- (org.springframework:spring-expression:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-asm:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-context-support:jar:3.0.3.RELEASE:compile
[INFO] | +- (org.springframework:spring-beans:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] +- org.springframework:spring-core:jar:3.0.3.RELEASE:compile
[INFO] | +- (org.springframework:spring-asm:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.1)
[INFO] +- org.springframework:spring-expression:jar:3.0.3.RELEASE:compile
[INFO] | \- (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] +- org.springframework:spring-jdbc:jar:3.0.3.RELEASE:compile
[INFO] | +- (org.springframework:spring-beans:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-tx:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] +- net.sf.jasperreports:jasperreports:jar:3.7.5:compile
[INFO] | +- commons-beanutils:commons-beanutils:jar:1.8.0:compile
[INFO] | | \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.1)
[INFO] | +- commons-collections:commons-collections:jar:2.1:compile
[INFO] | +- commons-digester:commons-digester:jar:1.7:compile
[INFO] | | +- (commons-beanutils:commons-beanutils:jar:1.6:compile - omitted for conflict with 1.8.0)
[INFO] | | +- (commons-logging:commons-logging:jar:1.0:compile - omitted for conflict with 1.1)
[INFO] | | +- (commons-collections:commons-collections:jar:2.1:compile - omitted for duplicate)
[INFO] | | \- (xml-apis:xml-apis:jar:1.0.b2:compile - omitted for duplicate)
[INFO] | +- (commons-logging:commons-logging:jar:1.0.2:compile - omitted for conflict with 1.1)
[INFO] | +- com.lowagie:itext:jar:2.1.7:compile
[INFO] | | +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO] | | +- (bouncycastle:bcprov-jdk14:jar:138:compile - omitted for conflict with 140)
[INFO] | | \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[INFO] | | +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO] | | \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
[INFO] | | \- (org.bouncycastle:bcprov-jdk14:jar:1.38:compile - omitted for duplicate)
[INFO] | +- jfree:jcommon:jar:1.0.15:compile
[INFO] | +- jfree:jfreechart:jar:1.0.12:compile
[INFO] | | \- (jfree:jcommon:jar:1.0.15:compile - omitted for duplicate)
[INFO] | +- (xml-apis:xml-apis:jar:1.3.02:compile - omitted for conflict with 1.0.b2)
[INFO] | \- eclipse:jdtcore:jar:3.1.0:compile
[INFO] +- org.json:json:jar:20160810:compile
[INFO] +- org.springframework:spring:jar:2.5.6:compile
[INFO] | \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.1)
[INFO] +- org.springframework:spring-webmvc:jar:3.0.3.RELEASE:compile
[INFO] | +- (org.springframework:spring-asm:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-beans:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-context-support:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-core:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | +- (org.springframework:spring-expression:jar:3.0.3.RELEASE:compile - omitted for duplicate)
[INFO] | \- (org.springframework:spring-web:jar:3.0.3.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
[INFO] +- org.opensaml:opensaml:jar:1.1:compile
[INFO] +- javax.mail:mail:jar:1.4:compile
[INFO] | \- javax.activation:activation:jar:1.1:compile
[INFO] +- jaxen:jaxen:jar:1.1-beta-6:compile
[INFO] | +- (jaxen:jaxen:jar:1.1-beta-4:compile - omitted for cycle)
[INFO] | +- (dom4j:dom4j:jar:1.5.2:compile - omitted for conflict with 1.6.1)
[INFO] | +- (jaxen:jaxen:jar:1.0-FCS:compile - omitted for cycle)
[INFO] | +- jdom:jdom:jar:1.0:compile
[INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] | +- xerces:xercesImpl:jar:2.6.2:compile
[INFO] | \- xom:xom:jar:1.0b3:compile
[INFO] | +- (xerces:xmlParserAPIs:jar:2.6.1:compile - omitted for conflict with 2.6.2)
[INFO] | +- (xerces:xercesImpl:jar:2.2.1:compile - omitted for conflict with 2.6.2)
[INFO] | +- com.ibm.icu:icu4j:jar:2.6.1:compile
[INFO] | +- (xalan:xalan:jar:2.6.0:compile - omitted for conflict with 2.7.1)
[INFO] | \- org.ccil.cowan.tagsoup:tagsoup:jar:0.9.7:compile
[INFO] +- commons-discovery:commons-discovery:jar:0.4:compile
[INFO] | \- (commons-logging:commons-logging:jar:1.0.4:compile - omitted for conflict with 1.1)
[INFO] +- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] +- com.liferay:nl.captcha.simplecaptcha:jar:1.1.1:compile
[INFO] +- org.springframework.webflow:spring-webflow:jar:2.3.3.RELEASE:compile
[INFO] | +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.1)
[INFO] | +- opensymphony:ognl:jar:2.6.11:compile
[INFO] | +- org.springframework.webflow:spring-binding:jar:2.3.3.RELEASE:compile
[INFO] | | +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.1)
[INFO] | | +- (opensymphony:ognl:jar:2.6.11:compile - omitted for duplicate)
[INFO] | | +- (org.springframework:spring-beans:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | | +- (org.springframework:spring-context:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | | +- (org.springframework:spring-core:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | | \- (org.springframework:spring-expression:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- org.springframework.webflow:spring-js:jar:2.3.3.RELEASE:compile
[INFO] | | +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.1)
[INFO] | | +- org.springframework.webflow:spring-js-resources:jar:2.3.3.RELEASE:compile
[INFO] | | +- (org.springframework:spring-beans:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | | +- (org.springframework:spring-context:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | | +- (org.springframework:spring-core:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | | +- (org.springframework:spring-web:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
[INFO] | | \- (org.springframework:spring-webmvc:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- (org.springframework:spring-beans:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- (org.springframework:spring-context:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- (org.springframework:spring-core:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- (org.springframework:spring-expression:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] | +- (org.springframework:spring-web:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.6.RELEASE)
[INFO] | \- (org.springframework:spring-webmvc:jar:4.0.0.RELEASE:compile - omitted for conflict with 3.0.3.RELEASE)
[INFO] \- org.apache.santuario:xmlsec:jar:1.5.8:compile
[INFO] \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for conflict with 1.1)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.336s
[INFO] Finished at: Fri Sep 29 15:03:00 EEST 2017
[INFO] Final Memory: 13M/245M
[INFO] ------------------------------------------------------------------------
-
首先为什么要复制
org.springframework.ldap:spring-ldap-core:jar
和org.springframework:spring-webmvc:jar
的依赖项?您应该只保留一个.First of all why you have duplicated dependencies of
org.springframework.ldap:spring-ldap-core:jar
andorg.springframework:spring-webmvc:jar
? You should keep only one.其次,计算
org.apache.santuario:xmlsec
出现的次数和多少个不同的版本(我计算4次,使用3个不同的版本:2.0.7
,1.4.2
,1.5.8
.前两个正在得到由于冲突而被省略,而选择的一个是缺少init
方法的一个1.5.8
.Secondly, count how many times
org.apache.santuario:xmlsec
appears and with how many different versions (I count 4 times, with 3 different versions:2.0.7
,1.4.2
,1.5.8
. The first two are getting omitted for conflict and the one selected is the las one1.5.8
which lacks theinit
method.因此,在依赖项方面您非常混乱.您应该尝试清理它并仅使用所需的依赖项.例如你应该 尝试降级/排除与
xmlsec-1.4.2
一起使用的所有内容并摆脱您的xmlsec-1.5.8
依赖项,或者升级所有与xmlsec-1.5.8
一起使用的内容.我发现wss4j-1.6.19
与xmlsec-1.5.8
兼容,因此删除您的xmlsec
依赖项并将wss4j
依赖项的版本更改为1.6.19
So, you have a very messy
pom.xml
in terms of dependencies. You should try to clean it up and use only the dependencies you need. For example you should either try to downgrade/exclude everything to work withxmlsec-1.4.2
and get rid of yourxmlsec-1.5.8
dependency, or upgrade everything to work withxmlsec-1.5.8
. I have found thatwss4j-1.6.19
works withxmlsec-1.5.8
so remove yourxmlsec
dependency and change the version ofwss4j
dependency to1.6.19
<dependency> <groupId>org.apache.ws.security</groupId> <artifactId>wss4j</artifactId> <version>1.6.19</version> </dependency>
在再次构建/运行项目之前,执行
mvn clean
清理目标和依赖项.Perform a
mvn clean
to clean up your target and dependencies before building/running again your project.更新不要删除您的
xmlsec-1.5.8
依赖项,因为将以com.onelogin:java-saml:jar:2.0.1
中的依赖项为准.只要让它在那里并尝试构建/运行您的项目UPDATEDo not remove your
xmlsec-1.5.8
dependency because the one fromcom.onelogin:java-saml:jar:2.0.1
will prevail. Just let it be there and try to build/run your project<dependency> <groupId>org.apache.santuario</groupId> <artifactId>xmlsec</artifactId> <version>1.5.8</version> </dependency>
我建议您也将
com.onelogin:java-saml:jar:2.0.1
降级到依赖xmlsec-1.5.8
而不是2.0.7
的版本.尝试使您的依赖项尽可能地整洁,mvn dependency:tree
是帮助您的好工具.I suggest you to downgrade also
com.onelogin:java-saml:jar:2.0.1
to a version that depends onxmlsec-1.5.8
and not on2.0.7
. Try to keep your dependencies as cleaner as you can andmvn dependency:tree
is a good tool to help you.这篇关于java.lang.NoSuchMethodError:org.apache.xml.security.transforms.Transform.init()V的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!