Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java jasypt suddenly crashes

Tags:

java

jasypt

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("Password");
        crypter.encrypt("Test");

Error msg:

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
like image 532
Jixo Avatar asked Jul 27 '20 11:07

Jixo


People also ask

Why does my Java crash?

JVM crashes can be caused by external components, either something directly used by the running software or indirectly related, for instance, virus protection or other system software. In these cases, it is unlikely that a bug report on java.com will help.

What causes a JVM to crash during code generation?

A JVM crash could also be caused due to a programming error or an error in third-party library code. The Following are the ways to identify and troubleshoot a JVM crash during code generation. If Java crashes while generating a code, the most common reason could be an error during method compilation.

What should I do if my Java SE application crashes?

If you experience a crash with a Java SE application and if you have native or JNI libraries that are compiled with a different release of the compiler, then you must consider compatibility issues between the runtimes. Specifically, your environment is supported only if you follow the Microsoft guidelines when dealing with multiple runtimes.

What is a crash file in JVM?

JVM produces this file itself when it crashes and proves extremely useful for classifying the Java crashes. It indicates that the JVM process has run out-of-virtual memory, and stack overflow errors are also mentioned. .core is a binary crash file produced on UNIX-based systems such as Linux and Solaris.


2 Answers

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.

like image 74
Brad Rippe Avatar answered Oct 21 '22 16:10

Brad Rippe


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.

like image 35
Leif H Avatar answered Oct 21 '22 17:10

Leif H