Skip to main content

Any help in installing BouncyCastle’s mail module in Glassfish 4.0

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2013-10-25

I’m trying to install and use BouncyCastle’s S/MIME functionality in glassfish 4.0, however I keep running into a number of ClassLoader Exceptions. I have deployed the bcmail-jdk15on-1.47 and bcprov-jdk15on-1.47 jars in the modules/endorsed folder. To ensure that all of the JavaMail classes are available and to avoid the “Can't load DCH” exception, I have put the “Activation”, “JavaMail API” and “JavaMail API dsn support” jars in the lib ext folder and exposed the packages via the file. Finally my test app tries to run the CreateSignedMail and ValidateSignedMail examples that are shipped with bcmail source code, however this results in the following exception:

2013-11-13 12:13:42,939 INFO glassfish 4.0 _ThreadID=167;_ThreadName=Thread-3; java.lang.NoClassDefFoundError: javax/mail/internet/MimeMultipart
at org.bouncycastle.mail.smime.handlers.multipart_signed.(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at javax.activation.MailcapCommandMap.getDataContentHandler(
at javax.activation.MailcapCommandMap.createDataContentHandler(
at javax.activation.DataHandler.getDataContentHandler(
at javax.activation.DataHandler.writeTo(
at javax.mail.internet.MimeBodyPart.writeTo(
at javax.mail.internet.MimeMessage.writeTo(
at javax.mail.internet.MimeMessage.writeTo(

Can anyone point me in the right direction?

bc-mail-signedMailTest-src.zip10.54 KB
bc-mail-signedMailTest-0.0.1-SNAPSHOT.jar12.82 KB