0 Replies Latest reply on Jan 29, 2013 7:56 AM by cherdt

    Java object instantiation exception after upgrade from CF9 to CF10

    cherdt Level 1

      I have some custom Java classes placed within the C:\ColdFusion10\cfusion\wwwroot\WEB-INF\classes directory of my CF10 install. Although these worked in CF9, I am now getting the following error:

       

      Error Occurred While Processing Request

      Object instantiation exception.

      An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. Error: javax/mail/Store.

       

      The exception log entry is similar:

       

      "Error","ajp-bio-8012-exec-1","01/28/13","21:51:08",,"Object instantiation exception.An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. Error: javax/mail/Store. The specific sequence of files included or processed is: sample\path\to\document\index.cfm, line: 1 "

      coldfusion.runtime.java.JavaObjectInstantiationException: Object instantiation exception.

       

      I created a simple sample that attempts to instantiate the object that throws the above exception:

      <cfscript>m = createObject( "Java", "sample.namespace.MBoxReader" );</script>

       

      I can create the same object in Java without error, e.g.:

      MBoxReader m = new MBoxReader();

       

      I checked, but as far as I can nothing attempts to instantiate the Store class, only subclasses of store. I have read in other posts that this may be due to missing classes or duplicate classes, so I'm not ruling that out, but haven't had much luck in identifying anything yet. Any tips on troubleshooting this issue?

       

      EDIT: I started with a much simpler Java class and started adding methods back to it. It appears to break when I attempt to instantiate a mail session:

      "Error","ajp-bio-8012-exec-1","01/29/13","10:17:22",,"javax/mail/Session The specific sequence of files included or processed is: sample\path\to\document\index.cfm, line: 3 "

      java.lang.NoClassDefFoundError: javax/mail/Session

       

      I built the project using the mail.jar file in C:\ColdFusion10\cfusion\lib, which contains a Session class. However, the Session class does not have a public constructor--maybe that's why CF has an issue.

       

      For example, calling this Java method via CF causes the error:

      public void mboxTest() {

         Properties props = new Properties();

         Session session = Session.getDefaultInstance( props );

      }