环境:jdk1.8、maven3.0.4、icu4j 2.6.1
异常信息:
Caused by: org.jasypt.exceptions.EncryptionInitializationException: java.lang.NoClassDefFoundError: Could not initialize class com.ibm.icu.impl.NormalizerImpl at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:708) at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.initialize(StandardPBEStringEncryptor.java:553) at org.jasypt.encryption.pbe.StandardPBEStringEncryptor.decrypt(StandardPBEStringEncryptor.java:705) at com.sinosoft.tech.security.shiro.SysJdbcRealm.doGetAuthenticationInfo(SysJdbcRealm.java:79) at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568) at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180) at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267) at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198) ... 60 more Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.ibm.icu.impl.NormalizerImpl at com.ibm.icu.text.Normalizer$Mode.normalize(Normalizer.java:190) at com.ibm.icu.text.Normalizer.normalize(Normalizer.java:1132) at com.ibm.icu.text.Normalizer.normalize(Normalizer.java:1101) at org.jasypt.normalization.Normalizer.normalizeWithIcu4j(Normalizer.java:137) at org.jasypt.normalization.Normalizer.normalizeToNfc(Normalizer.java:105) at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:653) ... 67 more本地运行一切正常,扔到测试环境部署就不行了,最后通过升级icu4j版本解决了该问题。
由于项目上的icu4j是jaxen 1.1.1这个依赖间接引入的,我是通过如下方式对icu4j进行的升级
<dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> <version>1.1.1</version> <exclusions> <exclusion> <groupId>xom</groupId> <artifactId>xom</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>xom</groupId> <artifactId>xom</artifactId> <version>1.0</version> <exclusions> <exclusion> <groupId>com.ibm.icu</groupId> <artifactId>icu4j</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.ibm.icu</groupId> <artifactId>icu4j</artifactId> <version>67.1</version> </dependency>