Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8074170

ClassNotFoundException: javax.mail.MessagingException using BouncyCastle mail

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 8u20
    • deploy
    • x86_64
    • linux

      FULL PRODUCT VERSION :
      java version "1.8.0_20"
      Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
      Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Linux dev1.site 3.7.10-1.40-desktop #1 SMP PREEMPT Thu Jul 10 11:22:12 UTC 2014 (9b06319) x86_64 x86_64 x86_64 GNU/Linux

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      tomcat 5.15

      A DESCRIPTION OF THE PROBLEM :
      In a JNLP application, when attempting to load a class from the BouncyCastle mail jar that in turn imports the javax.mail.MessagingException class, a ClassNotFoundException is thrown. It is important to note that the application runs fine as a normal java program.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the test jnlp program.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      It should print "Found classes." to standard out.
      ACTUAL -
      The JNLP download dialog appears and then reports an Application Error.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.ClassNotFoundException: javax.mail.MessagingException
      at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
      at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at com.oss.main.TryMain.main(TryMain.java:10)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at com.sun.javaws.Launcher.executeApplication(Unknown Source)
      at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
      at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Thread.java:745)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      The Main class:

      package com.oss.main;

      import org.bouncycastle.mail.smime.SMIMESignedGenerator;


      public class TryMain
      {
        public static void main( String[] args )
        {
          SMIMESignedGenerator gen = new SMIMESignedGenerator();
          System.out.println( "Found classes." );
        }
      }

      The JNLP file:

      <?xml version="1.0" encoding="utf-8"?>
      <!-- JNLP File for Test -->

      <jnlp spec="1.0+" codebase="$$codebase" href="Test.jnlp">
         <information>
            <title>Test</title>
            <vendor>OSS, LLC</vendor>
            <application-desc>Test of ClassNotFoundException for javax.mail.MessagingException</application-desc>
         </information>
         <resources>
          <!-- Application jars -->
          <jar href="main.jar" main="true"/>
          <jar href="javax.mail.jar"/>
          <jar href="bcpg-jdk15on-151.jar"/>
      <jar href="bcprov-jdk15on-151.jar"/>
      <jar href="bcmail-jdk15on-151.jar"/>
          <jar href="bcpkix-jdk15on-151.jar"/>
          
      <j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se"/>
          
         </resources>
         
         <application-desc main-class="com.oss.main.TryMain"/>
         
        <security>
         <all-permissions/>
      </security>
      </jnlp>

      All the jars are signed by with my cert and the BouncyCastle jars are also signed by them as a JCE provider.
      ---------- END SOURCE ----------

      SUPPORT :
      YES

            alitvinov Anton Litvinov (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: