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 Webapp/WEB-INF/lib
, YourAppServer/lib
, JRE/lib
and 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:
System.out.println(Base64.class.getProtectionDomain().getCodeSource().getLocation());
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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…