WAS8.5.5 使用druid1.1.21密码加密时,解密报错:java.lang.IllegalArgumentException: Failed to decrypt.

xzlaal3s  于 2022-10-27  发布在  Druid
关注(0)|答案(4)|浏览(816)

[20-7-10 10:21:45:328 CST] 0000006a SystemOut O [ERROR] [10:21:45] com.alibaba.druid.pool.DruidDataSource - {dataSource-1} init error
java.lang.IllegalArgumentException: Failed to decrypt.
at com.alibaba.druid.filter.config.ConfigFilter.decrypt(ConfigFilter.java:205)
at com.alibaba.druid.filter.config.ConfigFilter.init(ConfigFilter.java:123)
at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:839)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1376)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1372)
at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:109)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:577)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:721)
at grp.pt.util.BaseDAO.queryForOne(BaseDAO.java:147)
at grp.pt.common.dao.ParameterDAO.getParameterByKey(ParameterDAO.java:138)
at grp.pt.common.bs.ParameterService.getParameterByKey(ParameterService.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:50)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy54.getParameterByKey(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy55.getParameterByKey(Unknown Source)
at grp.pt.util.cache.RemoteCacheFactory.afterPropertiesSet(RemoteCacheFactory.java:140)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(AccessController.java:252)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:1678)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:414)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1175)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:774)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2182)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by:
java.lang.IllegalArgumentException: Failed to get public key
at com.alibaba.druid.filter.config.ConfigTools.getPublicKey(ConfigTools.java:101)
at com.alibaba.druid.filter.config.ConfigFilter.getPublicKey(ConfigFilter.java:223)
at com.alibaba.druid.filter.config.ConfigFilter.decrypt(ConfigFilter.java:195)
... 78 more
Caused by:
java.security.NoSuchProviderException: Provider SunRsaSign is not available
at java.security.KeyFactory.getInstance(KeyFactory.java:98)
at com.alibaba.druid.filter.config.ConfigTools.getPublicKey(ConfigTools.java:98)
... 80 more
[20-7-10 10:21:45:331 CST] 0000006a SystemOut O [ERROR] [10:21:45] grp.pt.common.bs.ParameterService - 错误:getParameterByKey

vmjh9lq9

vmjh9lq91#

<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
	<property name="url" value="jdbc:oracle:thin:@192.168.3.28:1521:orcl" />
	<property name="username" value="pb_104" />
	<property name="password" value="KgKsBQQlBCuRvBeaZaOZE+H90RX8Ye9gxksE1Ll1mUe/YnOygPEIF+tEMSa+TIxhltATRhhCeALsOSUVp1RjqQ==" />
<!-- 解密密码必须要配置的项 -->
<property name="filters" value="config" />
<property name="connectionProperties" value="config.decrypt=true;config.decrypt.key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIUk3DAt1zYhAaUWunLC3Y55PpsOvtZKa9UF/sHAeCPRg9WYQP0g4KjAmWNsaV1U8mpMQ7oPtN8GpKosSOz3NekCAwEAAQ==" />		
	<!-- SQL合并、慢SQL记录 -->
	<!-- property name="connectionProperties" value="druid.stat.slowSqlMillis=3000" /-->
	<!-- 打开removeAbandoned功能 -->
	<property name="removeAbandoned" value="true" />
	<property name="removeAbandonedTimeout" value="1800" />
	<!-- 关闭abanded连接时输出错误日志 -->
	<property name="logAbandoned" value="true" />
	<property name="timeBetweenEvictionRunsMillis" value="60000" />
	<property name="minEvictableIdleTimeMillis" value="300000" />
	<property name="testWhileIdle" value="true" />
	<property name="poolPreparedStatements" value="true" />
	<property name="maxActive" value="200" />
	<property name="initialSize" value="10" />
	<property name="maxIdle" value="50"/>  
	<property name="minIdle" value="10" />
	<property name="maxWait" value="60000" />
<property name="validationQuery" value="SELECT 1 from dual" />
<!--申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 -->
<property name="testOnBorrow" value="false" />
<!--归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 -->
<property name="testOnReturn" value="false" />		
</bean>

以上配置在TOMCAT SunJdk 1.6 环境下正常使用的,但WAS下会报解密错误,我的项目需要在WAS8.5.5下发布,有解决办法吗?

1l5u6lss

1l5u6lss2#

可以参考这个 link

在 IBM WebSphere 中使用 RSA 密钥时,URL 签名失败 (6271087)
在 IBM WebSphere 中使用 RSA 密钥时,URL 字符串签名失败并抛出以下异常:

错误:FSSignatureUtil.signAndReturnQueryString:签署查询字符串时发生 FSSignatureException:无此提供者:SunRsaSign
解决方法:WebSphere 绑定的 JDK 中缺少“SunRsaSign”提供者。要修复此问题,请编辑 websphere_jdk_root/jre/lib/security/java.security 文件,并添加以下行以启用 "SunRsaSign" 作为提供者之一:

security.provider.6=com.sun.rsajca.Provider

ar5n3qh5

ar5n3qh53#

解决方法:WebSphere 绑定的 JDK 中缺少“SunRsaSign”提供者。要修复此问题,请编辑 websphere_jdk_root/jre/lib/security/java.security 文件,并添加以下行以启用 "SunRsaSign" 作为提供者之一:

security.provider.6=com.sun.rsajca.Provider

以上解决方案在测试环境验证没报错,还是同样的错误。

相关问题