i'm trying to use Apache common.codec library to do some encryption in java, here is a sample code snippet:
String password = "abc124";
String salt = "$1$69$";
String cryptedPassword = org.apache.commons.codec.digest.Md5Crypt.md5Crypt(password.getBytes(), salt);
System.out.println(cryptedPassword);
And my .pom files CURRENTLY contains only this dependency:
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
When i try to execute that code snippet, i obtain this strange and uncommon error:
Exception in thread "main" 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 at org.apache.commons.codec.digest.Md5Crypt.md5Crypt(Md5Crypt.java:196) at org.apache.commons.codec.digest.Md5Crypt.md5Crypt(Md5Crypt.java:161) at Tester.main
I've tried to update library version to 1.10, with same issue. I've also tried do upgrade java version, that, currently is:
java -version java version "1.8.0_131" Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
javac-version javac 1.8.0_131
And my environment is running on OSX.