gpt4 book ai didi

spring - Jasypt 加密在升级到 JDK 7u261 后停止工作

转载 作者:行者123 更新时间:2023-12-03 20:25:47 37 4
gpt4 key购买 nike

我们最近从 JDK 7u251 升级到 JDK 7u261,因为 Java SE 支持客户于 2020 年 4 月 15 日可以使用新版本。在此 Java 版本升级后,Jasypt 加密停止工作。我收到以下错误消息;

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.decrypt(StandardPBEStringEncryptor.java:718)
at org.jasypt.properties.PropertyValueEncryptionUtils.decrypt(PropertyValueEncryptionUtils.java:72)
at org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer.convertPropertyValue(EncryptablePropertyPlaceholderConfigurer.java:111)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.convertProperty(PropertyResourceConfigurer.java:121)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.convertProperties(PropertyResourceConfigurer.java:104)
at org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:81)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:669)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5136)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5662)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1007)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:983)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:639)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1296)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:2038)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
at java.lang.Thread.run(Thread.java:745)
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)
... 26 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)
... 35 more

applicationContext.xml中使用的代码如下;
<bean id="encryptorConfig" class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWithMD5AndDES" />
<property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD" />
</bean>

<bean id="encryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config" ref="encryptorConfig" />
</bean>

<bean class="org.jasypt.spring.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="encryptor" />

<property name="locations">
<list>
<value>/WEB-INF/spring.properties</value>

</list>
</property>

</bean>

最佳答案

尝试添加更新的 icu4j 依赖项。另请参阅 Jasypt 项目中的以下错误报告:“Encryption stops working after upgrade to Java™ SE Development Kit 7, Update 261 (JDK 7u261)”。
提到的错误修复更新为:

<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>67.1</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>

关于spring - Jasypt 加密在升级到 JDK 7u261 后停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61462535/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com