Getting java.lang.NoSuchMethodError. mvn dependency:tree shows correct dependency being used

2.1k views Asked by At

I am getting

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

I have added dependency

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

which contains wss4.jar -> xmlsec.jar -> JCE Mapper, as can be seen from mvn dependency tree.

[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

I ran a test class to see where JCEMapper is being loaded from:

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());

        }
    }
}

And i get expected output

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

When i inspect JCEMapper class under jar xmlsec-1.5.4.jar i do see the method translateURItoJCEID.

0

There are 0 answers