java.lang.NoSuchMethodError:org.apache.xml.security.transforms.Transform.init()V

时间:2017-09-29 09:27:57

标签: java xml spring apache maven

我有一个java类负责连接到Web服务以验证证书,情况是当我采取步骤调用WS时,它返回以下错误: java.lang.NoSuchMethodError:org.apache.xml.security.transforms.Transform.init()V

我已尝试删除库但不起作用。

我的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>

栈跟踪

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)

谢谢!

1 个答案:

答案 0 :(得分:1)

正如我在第一次评论中建议的那样。您有冲突的jar xmlsec.jar被导入到您的项目中作为来自其他具有许多不同版本的jar的依赖(我计算了3个版本)。在所有3个版本中,最终选择版本为1.5.6的版本,而这是缺少init()调用的wss4j.jar:1.5.6方法的版本。

这可以通过调用maven中的依赖关系树来观察,我在这里发布结果:

[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:jarorg.springframework:spring-webmvc:jar的重复依赖项?你应该只保留一个。

  • 其次,计算org.apache.santuario:xmlsec出现的次数和不同版本的数量(我计算4次,有3个不同的版本:2.0.71.4.2,{{1前两个因为冲突而被省略,而选择的是一个1.5.8,它缺少1.5.8方法。

因此,就依赖性而言,你有一个非常混乱的init。您应该尝试清理它并仅使用您需要的依赖项。比如你应该  尝试降级/排除所有内容以使用pom.xml并删除您的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

在构建/再次运行项目之前,执行<dependency> <groupId>org.apache.ws.security</groupId> <artifactId>wss4j</artifactId> <version>1.6.19</version> </dependency> 来清理目标和依赖项。

<强>更新 请勿删除mvn clean依赖关系,因为xmlsec-1.5.8中的关联将占优势。只需让它在那里并尝试构建/运行您的项目

com.onelogin:java-saml:jar:2.0.1

我建议您将<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是一个很好的工具来帮助您。