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:
<module xmlns="urn:jboss:module:1.1" name="org.bouncycastle">
<resources>
<resource-root path="bcprov-jdk16-1.46.jar"/>
</resources>
<dependencies>
<module name="javax.api" slot="main" export="true"/>
</dependencies>
</module>
Once you have setup the module you need to make it available to your deployments. There are two ways:
1. Globally via standalone.xml
In $JBOSS_HOME/standalone/configuration/standalone.xml replace
<subsystem xmlns="urn:jboss:domain:ee:1.0"/>
with
<subsystem xmlns="urn:jboss:domain:ee:1.0">
<global-modules>
<module name="org.bouncycastle" slot="main"/>
</global-modules>
</subsystem>
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)
2. For a specific deployment (preferred)
Add a module dependency entry to the ear's META-INF/jboss-deployment-structure.xml
file, under the section, eg:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<module name="org.bouncycastle" slot="main" export="true" />
</dependencies>
</deployment>
</jboss-deployment-structure>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…