I follow this instruction to add bouncycastle: http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation but I have still one problem. Sometimes when I redeploy my application this provider isnt found so then my application throw exception. This problem occurs just one per 100 redeploy (maybe less). When I restart my server - weblogic then it start working again. I will be very grateful for any advice why this problem occurs
EDIT:
I am using both method in link above because when I use just one of them then it doesnt work I add to java.security this provder and then in my class I registered this provder:
static {
Security.addProvider(new BouncyCastleProvider());
}
You probably got a NoClassDefFoundError
. This is a known issue with JSSE implementations.
Here is the scenario:
As there is no standard listener for the undeploy event, it is not possible to trigger the JSSE provider removal at time.
The recommended way to avoid that trouble is to have bouncy castle classes in your JVM ClassPath or in your container ClassPath. You have to remove it from your application. Now you need to register BC provider with an alternate option to the static initializer. WebLogic provides ways to trigger code at server startup (I have used server startup class), this code will be responsible to register JSSE providers for the whole server/JVM lifetime.
An alternate option is to add the following line in JRE java.security
file with bouncy castle jar in jre/lib/ext
but I do not like that way because it may be lost when updating: security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider
So then the application simply expects implementations are there, it may be a good idea to add tests for algorithm availability to report any troubles to operators and users.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With