I use BouncyCastle for encryption in my application. When I run it standalone, everything works fine. However, if I put it in the webapp and deploy on JBoss server, I get a
For JBoss AS7 bouncy castle needs to be deployed as a server module. This replaces the server/default/lib
mechanism of earlier versions (as mentioned in Gergely Bacso's answer).
JBoss AS7 uses jdk1.6+. When using JBoss AS7 with jdk1.6 we need to make sure we are using bcprov-jdk16.
Create a Jboss module (a folder $JBOSS_HOME/modules/org/bouncycastle/main).
Put the bouncy castle jars that you want to be globally available in it, along with a module.xml
file that looks like this:
Once you have setup the module you need to make it available to your deployments. There are two ways:
In $JBOSS_HOME/standalone/configuration/standalone.xml replace
with
The jar libraries will now be available across all applications (and this will "emulate" adding to the classpath as was possible in jboss 4,5,6 etc)
Add a module dependency entry to the ear's META-INF/jboss-deployment-structure.xml
file, under the section, eg: