Skip to main content

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

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
bazil2
Offline
Joined: 2013-10-25

Hi,
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 osgi.properties 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(Class.java:188)
at javax.activation.MailcapCommandMap.getDataContentHandler(MailcapCommandMap.java:593)
at javax.activation.MailcapCommandMap.createDataContentHandler(MailcapCommandMap.java:550)
at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:612)
at javax.activation.DataHandler.writeTo(DataHandler.java:316)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1574)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1840)
at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1816)
at bcmailtest.org.bouncycastle.mail.smime.examples.CreateSignedMail.main(CreateSignedMail.java:218)
at bcmailtest.org.bouncycastle.mail.smime.examples.App.doTest(App.java:25)

Can anyone point me in the right direction?
Thanks

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