org.apache.commons.codec.digest.Md5Crypt.md5Crypt函数.异常发生在linux下,但在Windows下很好 [英] org.apache.commons.codec.digest.Md5Crypt.md5Crypt function. exception occured under linux, but fine under windows

查看:331
本文介绍了org.apache.commons.codec.digest.Md5Crypt.md5Crypt函数.异常发生在linux下,但在Windows下很好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用commons-codec函数和org.apache.commons.codec.digest.Md5Crypt.md5Crypt函数对密码进行加密.

We are using commons-codec to encrypt passwords, using the org.apache.commons.codec.digest.Md5Crypt.md5Crypt function.

它在Windows环境下可以正常工作,但在CentOS上会引发异常.

It works fine on a Windows environment, but on CentOS, an exception is thrown.

我们有3个centOS测试服务器:一台是centOS7,一台是centOS6.7,一台是centOS7 minimal. 最奇怪的是,该代码可在centOS7服务器上运行,而不能在其他两个服务器上运行.它们之间的唯一区别是操作系统.相同的tomcat,相同的jdks,相同的版本.

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.

在Linux下还需要其他东西吗?

Does it need any other things under linux?

异常消息:

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

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 ?

,或者至少发生了一些变化.这是不兼容的问题:请注意: java.lang.IllegalAccessError:尝试访问方法

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

这篇关于org.apache.commons.codec.digest.Md5Crypt.md5Crypt函数.异常发生在linux下,但在Windows下很好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆