-
1. Re: How to add bouncycastle to JBoss AS 7.1
john.genoese Nov 26, 2011 7:16 PM (in response to john.genoese)I'm not sure what I was doing wrong before, but the following works beautifully, without having to alter the JVM in any way.
- Create an 'org.bouncycastle' module in the following manner:
- Under $JBOSS_HOME/modules, create directory 'org/bouncycastle/main'. Directory 'org' will already be there.
- Copy bcprov-jdk16-1.46.jar into org/bouncycastle/main
- Create file 'bcprov-jdk16-1.46.jar.index' in org/bouncycastle/main, which is basically the output of a "jar -tf" command without the ".class" lines. I put a blank line at the top because these .index files always seem to have one. I have attached this file as "bcprov-jdk16-1.46.jar.index".
- Create a file called "module.xml", also in org/bouncycastle/main, which will point to the jar file and reference module "javax.api" as a dependency. I have attached this file as 'module.xml'.
- The module is complete.
- Since I am deploying in an EAR file, I had to add a module dependency entry to my EAR's META-INF/jboss-deployment-structure.xml file, under the <deployment><dependencies> section, like so:
{code:xml}
<deployment> <dependencies> <module name="org.bouncycastle" slot="main" export="true"/> {code}
- Make certain that the ear's /lib directory does NOT contain bcprov-jdk16-1.46.jar.
Notes:
- The 'slot="main" and 'export="true" parameters are very important in the jboss-dependency-structure.xml file. I spent a few iterations getting that corrected. For example, my app couldn't see the bouncycastle classes when I omitted 'slot="main" from the org.bouncycastle dependency. Ugh!
- Using the JVM option "-verbose:class" helped a lot in debugging this. In one permutation, I actually was able to see the same Bouncy Castle classes loaded under two different class loaders! That was when I had the JVM itself configured AND has the classes in EAR/lib -- twice wrong!
I think that's it.
My deepest thanks to the JBoss and Bouncy Castle communities for creating these world-class platforms. I had grumblings about JBoss Modules at first, but now that I understand it a bit better, I realize that it's a good approach. One could easily envision the creation of canonical modules in various problem domains. I just hope that somehow it coordinates with maven (unless it already does and It just got by me).
-
module.xml 1.3 KB
-
bcprov-jdk16-1.46.jar.index.zip 652 bytes
- Create an 'org.bouncycastle' module in the following manner:
-
2. Re: How to add bouncycastle to JBoss AS 7.1
vinprabhuu Feb 15, 2012 12:44 AM (in response to john.genoese)Perfect solution.. Thanks alot
-
3. Re: How to add bouncycastle to JBoss AS 7.1
nscavell Apr 5, 2013 2:26 PM (in response to john.genoese)Another option, if you want to bundle bouncycastle in the WAR instead of having to add a module to as7, is have jboss-deployment-structure.xml file as such
<jboss-deployment-structure> <deployment> <resources> <resource-root path="WEB-INF/lib/bcprov-jdk16-1.46.jar" use-physical-code-source="true"/> </resources> </deployment> </jboss-deployment-structure>
This gets around the VFS error that you mention. I believe it's a non-issue if you use openjdk.
-
4. Re: How to add bouncycastle to JBoss AS 7.1
alexc099 Apr 5, 2013 3:20 PM (in response to nscavell)Dude, I was this close to asking if anyone knew how to do this for a WAR deployment. (Seriously, I was typing in a post when I started getting "Internal Server Error" popups and reloaded the page.) That totally fixed my problem. You rock.
-
5. Re: How to add bouncycastle to JBoss AS 7.1
nscavell Apr 5, 2013 4:00 PM (in response to alexc099)Haha that's funny. Glad I could help
-
6. Re: How to add bouncycastle to JBoss AS 7.1
ldtung.it Oct 9, 2013 2:47 AM (in response to nscavell)Hello Nick Scavelli,
Thanks for your help and I followed exactly what you mentioned but I got this case:
- Build Application.ear
- Start JBOSS AS 7 standalone server
- upload Application.ear to jboss AS 7 server
-> then the bouncyCastle not get loaded
- Restart JBOSS AS 7 server
- This time, bouncyCastle get loaded and everything went fine.
Do you have any idea about this?
-
7. Re: How to add bouncycastle to JBoss AS 7.1
ldtung.it Oct 9, 2013 3:04 AM (in response to ldtung.it)I forgot to mention my ear structure
Application.EAR
-----lib
-----META-INF
-----Application.war
And my jboss-deployment-structure.xml
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<resources>
<resource-root path="WEB-INF/lib/bcprov-jdk15on-1.47.jar" use-physical-code-source="true"/>
<resource-root path="WEB-INF/lib/bcpkix-jdk15on-1.47.jar" use-physical-code-source="true"/>
<resource-root path="WEB-INF/lib/bcmail-jdk15on-1.47.jar" use-physical-code-source="true"/>
</resources>
</deployment>
</jboss-deployment-structure>
-
8. Re: How to add bouncycastle to JBoss AS 7.1
tullio0106 Dec 20, 2013 4:15 AM (in response to john.genoese)Bad idea in such way I'm forced to use different wars for different Application Servers also when is not needed or usefull.
Why such problem with Bouncy Castel ?
Is there an alternative solution ?
Tks
Tullio
-
9. Re: How to add bouncycastle to JBoss AS 7.1
valsaraj007 Apr 8, 2015 2:51 AM (in response to nscavell)How can I bundle bouncycastle in the EAR? The libraries are in app.ear/lib folder.