We are using commons-codec
to encrypt passwords, using the org.apache.commons.codec.digest.Md5Crypt.md5Crypt
function.
It works fine on a Windows environment, but on CentOS, an exception is thrown.
We have 3 centOS test servers: one is centOS7, one is centOS6.7, and one is centOS7 minimal. The weirdest thing is, the code works on the centOS7 server, but not on the other two. The only difference between them is the OS. Same tomcats, same jdks, same builds.
Does it need any other things under linux?
The exception message:
java.lang.IllegalAccessError: tried to access method org.apache.commons.codec.digest.DigestUtils.getMd5Digest()Ljava/security/MessageDigest; from class org.apache.commons.codec.digest.Md5Crypt
have you checked the jar ? and the presence of the library ? Perhaps it was removed for some obscure security / patent / export reason ?
or, at least, something changed. It is a problem of incompatibility: see that: java.lang.IllegalAccessError: tried to access method
Or you have already (loaded) this class, because you have multiple incompatible instances . Try to find it in your packages (caller function, or called)
but why not directly use the library ?
import java.security.*;
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] thedigest = md.digest(_originebyte);