Code used for decoding: Base64.decodeBase64("String");
Commons-codec jar version: 1.9
Exception: nested exception is java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.decodeBase64(Ljava/lang/String;)
Environment Details: OS: SunOS Version: 5.11 Java Version: 1.8.0_221 (Oracle corporation)
Same WAR working in below environment Environment Details: OS: AIX Version: 7.1 Java Version: 1.8.0_191 (IBM JDK)
If you are getting a NoSuchMethodError
, that means that you have a runtime version incompatibility problem. Some part of the codebase depends on1 a version of Base64
that has a method called decodeBase64
that takes a single String
argument. But the version of the class that has been loaded doesn't have that method.
There is a clue in the javadoc for the method. It says that the method was added to the Base64
in version 1.4 of the API. So check the JAR files that are deployed to see if there is an older (pre 1.4) version of the Apache Commons Codec JAR on the runtime classpath.
1 - It could be a static dependency; i.e. a normal method call. It could also be a dynamic dependency; e.g. attempting to lookup the method using reflection.