1、我的代碼中引用了bcprov-jdk16-146.jar,在部署到jboss7.1.1時報如下異常:
Caused by: java.lang.SecurityException: JCE cannot authenticate the provider BC
at javax.crypto.SunJCE_b.a(DashoA13*..)
at javax.crypto.SecretKeyFactory.getInstance(DashoA13*..)
at org.jasypt.encryption.pbe.StandardPBEByteEncryptor.initialize(StandardPBEByteEncryptor.java:667)
... 95 more
Caused by: java.util.jar.JarException: Cannot parse jar:file:/Users/himajumdar/Work/jboss/jboss-5.1.0.GA/server/default/tmp/a00c-b5p2h4-hgi84jo1-1-hgi84qe5-w/csa.ear!/lib/bcprov-jdk16-146
at javax.crypto.SunJCE_c.a(DashoA13*..)
at javax.crypto.SunJCE_b.b(DashoA13*..)
at javax.crypto.SunJCE_b.a(DashoA13*..)
... 98 more
2、然後按照網上說的我在JAVA_HOME/jre/lib/security/java.security下增加
security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider to java.security
將該jar包放到JAVA_HOME/jre/lib/ext下,並將項目中的該jar去掉
結果又報出如下問題:
ERROR java.lang.ClassNotFoundException: org.bouncycastle.jce.provider.BouncyCastleProvider
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
哪位大俠能給解決下呢
該問題解決了,具體的解決過程:
1、 在jboss下創建如下目錄:$JBOSS_HOME/modules/org/bouncycastle/main,將bcprov-jdk16-146.jar、module.xml(該文件可比其它目錄copy過來)放到該目錄下,
module.xml文件放如下 內容:
2、在 $JBOSS_HOME/standalone/configuration/standalone.xm文件中,找到這一行,將它替換為:
以上兩步操作完即可,不需要其它操作了