Java Jasypt 突然崩溃

huangapple go评论131阅读模式
英文:

java jasypt suddenly crashes

问题

自从昨天起,我的文本加密器(jasypt)无故停止工作了。以下是代码示例和错误信息。有人知道发生了什么吗?

代码示例:

StrongTextEncryptor crypter = new StrongTextEncryptor();
crypter.setPassword("Password");
crypter.encrypt("Test");

错误信息:

Exception in thread "main" org.jasypt.exceptions.EncryptionInitializationException: java.lang.ExceptionInInitializerError
	at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:773)
	at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.initialize(StandardPBEStringEncryptor.java:566)
	at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.encrypt(StandardPBEStringEncryptor.java:644)
	at org.jasypt.util.text.StrongTextEncryptor.encrypt(StrongTextEncryptor.java:107)
	at A.main(A.java:8)
Caused by: java.lang.ExceptionInInitializerError
	at com.ibm.icu.impl.NormalizerDataReader.<clinit>(NormalizerDataReader.java:300)
	at com.ibm.icu.impl.NormalizerImpl.<init>(NormalizerImpl.java:288)
	at com.ibm.icu.impl.NormalizerImpl.<clinit>(NormalizerImpl.java:35)
	at com.ibm.icu.text.Normalizer$Mode.normalize(Normalizer.java:188)
	at com.ibm.icu.text.Normalizer.normalize(Normalizer.java:1177)
	at com.ibm.icu.text.Normalizer.normalize(Normalizer.java:1146)
	at org.jasypt.normalization.Normalizer.normalizeWithIcu4j(Normalizer.java:205)
	at org.jasypt.normalization.Normalizer.normalizeToNfc(Normalizer.java:129)
	at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:718)
	... 4 more
Caused by: java.lang.IllegalArgumentException: Invalid version number: Version number may be negative or greater than 255
	at com.ibm.icu.util.VersionInfo.getInstance(VersionInfo.java:188)
	at com.ibm.icu.impl.ICUDebug.getInstanceLenient(ICUDebug.java:65)
	at com.ibm.icu.impl.ICUDebug.<clinit>(ICUDebug.java:69)
	... 13 more
英文:

Since yesterday my textencrypter(jasypt) stopped working for no reason. Here is a code example and the error msg. Does anybody know what is going on?

Code example:

		StrongTextEncryptor crypter = new StrongTextEncryptor();
crypter.setPassword(&quot;Password&quot;);
crypter.encrypt(&quot;Test&quot;);

Error msg:

Exception in thread &quot;main&quot; org.jasypt.exceptions.EncryptionInitializationException: java.lang.ExceptionInInitializerError
at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:773)
at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.initialize(StandardPBEStringEncryptor.java:566)
at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.encrypt(StandardPBEStringEncryptor.java:644)
at org.jasypt.util.text.StrongTextEncryptor.encrypt(StrongTextEncryptor.java:107)
at A.main(A.java:8)
Caused by: java.lang.ExceptionInInitializerError
at com.ibm.icu.impl.NormalizerDataReader.&lt;clinit&gt;(NormalizerDataReader.java:300)
at com.ibm.icu.impl.NormalizerImpl.&lt;init&gt;(NormalizerImpl.java:288)
at com.ibm.icu.impl.NormalizerImpl.&lt;clinit&gt;(NormalizerImpl.java:35)
at com.ibm.icu.text.Normalizer$Mode.normalize(Normalizer.java:188)
at com.ibm.icu.text.Normalizer.normalize(Normalizer.java:1177)
at com.ibm.icu.text.Normalizer.normalize(Normalizer.java:1146)
at org.jasypt.normalization.Normalizer.normalizeWithIcu4j(Normalizer.java:205)
at org.jasypt.normalization.Normalizer.normalizeToNfc(Normalizer.java:129)
at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:718)
... 4 more
Caused by: java.lang.IllegalArgumentException: Invalid version number: Version number may be negative or greater than 255
at com.ibm.icu.util.VersionInfo.getInstance(VersionInfo.java:188)
at com.ibm.icu.impl.ICUDebug.getInstanceLenient(ICUDebug.java:65)
at com.ibm.icu.impl.ICUDebug.&lt;clinit&gt;(ICUDebug.java:69)
... 13 more

答案1

得分: 18

这不是一个直接的答案,但我把它放在这里,以防有人遇到这个问题。

在使用Java 1.8.0_275时,当运行encrypt.sh时,我遇到了一个

java.lang.ExceptionInInitializerError

的错误。

Jasypt版本1.9.3使用了icu4j-3.4.4.jar的旧版本。我用icu4j-68_2.jar替换了icu4j-3.4.4.jar,然后我就能够运行:

./encrypt.sh input=password password=aSecret algorithm=PBEWithMD5AndDES

而没有错误。

更多信息,请参见https://github.com/jasypt/jasypt/issues/58。尽管这与您运行jasypt的方式有些不同,但我建议更新icu4j.jar,然后再次尝试。

英文:

This is not a direct answer, but I'm putting it here in case someone runs upon the issue.

Using Java 1.8.0_275, I was getting a

java.lang.ExceptionInInitializerError

when running the encrypt.sh.

Jasypt version 1.9.3 is using an old version of icu4j-3.4.4.jar. I replaced the icu4j-3.4.4.jar with icu4j-68_2.jar then I was able to run:

./encrypt.sh input=password password=aSecret algorithm=PBEWithMD5AndDES

without error.

For more information, see https://github.com/jasypt/jasypt/issues/58. Even though this is a little different from how you're running jasypt, I'd recommend updating the icu4j.jar and try again.

答案2

得分: 1

问题似乎与icu4j有关(至少在我的情况下是这样)。
在jasypt的Github上找到了这个提交:https://github.com/jasypt/jasypt/commit/d384f9a755af2938bc142f7575365bee42ba5f22
更新了依赖项后,应用程序开始运行。

英文:

Problem seems to be related (at least in my case) to icu4j.
Found this commit on jasypt Github https://github.com/jasypt/jasypt/commit/d384f9a755af2938bc142f7575365bee42ba5f22
Updated dependency and application started running.

答案3

得分: 0

在 GitHub 上 jasypt 的问题 44 的评论中提到,只需删除旧的 icu4j-3.4.4.jar 文件。换句话说,不必费力寻找替代品。对我来说运行正常。:-) 感谢 Brad Rippe 提供线索!

DSOANS 在 2020 年 8 月 24 日发表评论
> 似乎修复方法是删除 com.ibm.icu4j jar
> (icu4j-3.4.4.jar)文件从分发中 - 至少对我们来说是这样的。

https://github.com/jasypt/jasypt/issues/44

英文:

A jasypt issue 44 comment on github says just to remove the old icu4j-3.4.4.jar. IOW, don't bother tracking down a replacement. Worked OK for me. Java Jasypt 突然崩溃 Thanks Brad Rippe for providing the clue!

DSOANS commented on Aug 24, 2020
> It appears the fix is to REMOVE the com.ibm.icu4j jar
> (icu4j-3.4.4.jar) file from the distribution - at least that seems to
> have worked for us.

https://github.com/jasypt/jasypt/issues/44

huangapple
  • 本文由 发表于 2020年7月27日 19:32:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/63114412.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定