Skip to main content
Inspiring
April 7, 2009
Question

Object Instantiation Exception. Creating Java Object

  • April 7, 2009
  • 2 replies
  • 30543 views

Hi,

I am trying to implement CyberSource Simple Order API and I am getting an error on CFobject

Object  Instantiation Exception.

An exception occurred when  instantiating a Java object. The class must not be an interface or an abstract  class. Error: com/cybersource/ws/client/ClientException.

So far I've placed the .jar file into :\ColdFusion8\wwwroot\WEB-INF\lib directory and on my cfpage I got:

<cfobject action="create" type="Java" class="CyberSource" name="auth">

Does anyone have any experience with CyberSource or the source of the error code?

Thanks in advance!

This topic has been closed for replies.

2 replies

TiGGiAuthor
Inspiring
April 8, 2009

Thanks for the reply, I figured out why I am getting the error.  I needed to include the rest of the Java classes that come with the package.  As soon as I did that it worked, somewhat.

Now I am getting another error:

500

ROOT CAUSE: 
java.lang.NoClassDefFoundError: Could not initialize class com.cybersource.ws.client.Signature

It looks like when it tries to run a function inside the java class:

<cfset myReply = auth.runTransaction(propsFile,myRequest)/>
Inspiring
April 8, 2009

I needed to include the rest of the Java classes that come with the package.  As soon as I did that it worked, somewhat.


Yes, the entire jar (and any supporting jars) must be placed in the CF class path. The error message indicates it needs a class named com.cybersource.ws.client.Signature but cannot find it.  Does that class exist in your cybersource jar(s)? Did you place all of the needed jars in the CF classpath?

Inspiring
April 7, 2009

You need to include the class's package (ie path), as well as the class name.  For example:

<cfset obj = createObject("java", "com.cybersource.ws.client.SomeClass")....>  .. instead of

<cfset obj = createObject("java", "SomeClass")....>

I do not use Cybersource, but you might review these references. The example on page 17 may be outdated, but it looks like a good starting point.

http://www.cfug-md.org/meetings/Montreal_CreditCardPayments.ppt
http://apps.cybersource.com/library/documentation/dev_guides/Simple_Order_API_Client_Java/html/intro.htm#intro_14664_14665