I am developing a Java EE application in which I need Base64 Encoding/Decoding
So I added
That method was introduced in Commons Codec 1.4. This exception indicates that you've an older version of Commons Codec somewhere else in the webapp's runtime classpath which got precedence in classloading. Check all paths covered by the webapp's runtime classpath. This includes among others the
JRE/lib/ext. Finally remove or upgrade the offending older version.
Update: as per the comments, you can't seem to locate it. I can only suggest to outcomment the code using that newer method and then put the following line in place:
That should print the absolute path to the JAR file where it was been loaded from during runtime.
Update 2: this did seem to point to the right file. Sorry, I can't explain your problem anymore right now. All I can suggest is to use a different
Base64 method like
encodeBase64(byte) and then just construct a
new String(bytes) yourself. Or you could drop that library and use a different Base64 encoder, for example this one.