我正在
java.lang.NoSuchMethodError: org.apache.xml.security.algorithms.JCEMapper.translateURItoJCEID(Ljava /郎/字符串;)Ljava /郎/字符串;
我添加了依赖
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
</dependency>
其中包含wss4.jar - &gt; xmlsec.jar - &gt; 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。