2

我正进入(状态

java.lang.NoSuchMethodError: org.apache.xml.security.algorithms.JCEMapper.translateURItoJCEID(Ljava/lang/String;)Ljava/lang/String;

我添加了依赖

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-ws-security</artifactId>
</dependency>

其中包含 wss4.jar -> xmlsec.jar -> JCE Mapper,从 mvn 依赖树可以看出。

[INFO] \- org.apache.cxf:cxf-rt-ws-security:jar:2.7.5:compile
[INFO]    +- net.sf.ehcache:ehcache-core:jar:2.5.1:compile
[INFO]    |  \- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO]    +- org.apache.ws.security:wss4j:jar:1.6.10:compile
[INFO]    |  +- org.apache.santuario:xmlsec:jar:1.5.4:compile
[INFO]    |  \- org.opensaml:opensaml:jar:2.5.1-1:compile
[INFO]    |     \- org.opensaml:openws:jar:1.4.2-1:compile
[INFO]    |        \- org.opensaml:xmltooling:jar:1.3.2-1:compile
[INFO]    |           \- joda-time:joda-time:jar:1.6.2:compile
[INFO]    \- commons-logging:commons-logging:jar:1.1.1:compile

我运行了一个测试类来查看从哪里加载 JCEMapper:

public class Test {
    public static void main(String[] args) {
        Class klass = JCEMapper.class;

        CodeSource codeSource = klass.getProtectionDomain().getCodeSource();

        if ( codeSource != null) {

            System.out.println(codeSource.getLocation());

        }
    }
}

我得到了预期的输出

文件:/C:/Users/Affan/.m2/repository/org/apache/santuario/xmlsec/1.5.4/xmlsec-1.5.4.jar

当我检查 jar xmlsec-1.5.4.jar 下的 JCEMapper 类时,我确实看到了 translateURItoJCEID 方法。

4

0 回答 0