org.apache.commons.codec.digest.Md5Crypt.md5Crypt function. exception occured under linux, but fine under windows

十年热恋 提交于 2019-12-09 03:58:54

问题


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


回答1:


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);


来源:https://stackoverflow.com/questions/34449400/org-apache-commons-codec-digest-md5crypt-md5crypt-function-exception-occured-un

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!