Object Instantiation Exception

84 views
Skip to first unread message

JP Revel

unread,
May 24, 2011, 11:15:47 PM5/24/11
to javaloa...@googlegroups.com
Hi everyone,
First time poster, first time javaloader user.  

I have a .jar of an object that I'd like to load, basically a container of strings & numbers for stock data that I plan to receive, and want to have an instance of the class loaded so I can call the methods on the class.  Using the loadHelloWorld as a guide, I replaced the HelloWorld example code with the SymbolPriceSnapshot code from a custom java object.

When I first tried running the page, I got an error that 'the requested class could not be found' and then realized that I wasn't calling the class within the package name.  When I changed the loader.create("com.supercompany.SymbolPriceSnapshot") I received the Object Instantiation Exception.  My java writing buddy tells me that the class is not an interface nor an abstract class.

Thanks for helping a lost soul.

Here is the error stack:

The error occurred in /Applications/ColdFusion9/wwwroot/javaloader/JavaLoader.cfc: line 329
Called from /Applications/ColdFusion9/wwwroot/javaloader/JavaLoader.cfc: line 87
Called from /Applications/ColdFusion9/wwwroot/javaloader/example/loadHelloWorld/symbol.cfm: line 31
Called from /Applications/ColdFusion9/wwwroot/javaloader/JavaLoader.cfc: line 329
Called from /Applications/ColdFusion9/wwwroot/javaloader/JavaLoader.cfc: line 87
Called from /Applications/ColdFusion9/wwwroot/javaloader/example/loadHelloWorld/symbol.cfm: line 31
327 : 	<cfargument name="class" hint="the java class to create the proxy with" type="any" required="Yes">
328 : 	<cfscript>
329 : 		return createObject("java", "coldfusion.runtime.java.JavaProxy").init(arguments.class);
330 : 	</cfscript>
331 : </cffunction>

Todd Sharp

unread,
May 24, 2011, 11:45:03 PM5/24/11
to javaloa...@googlegroups.com

We would need to see the java code and the CF code that you're using to call it with to help you out.

On May 24, 2011 11:15 PM, "JP Revel" <jp.r...@gmail.com> wrote:

Mark Mandel

unread,
May 25, 2011, 12:04:54 AM5/25/11
to javaloa...@googlegroups.com
Also looks like a nasty exception that is deeply nested.

Wrap your code in a try/catch and dump the exception, and paste that up here too. CF can hide real errors often to.

You will probably find a 'Caused by:' clauses 3 levels down that will tell you what is really going on.

Mark


On Wed, May 25, 2011 at 1:45 PM, Todd Sharp <cfsi...@gmail.com> wrote:

We would need to see the java code and the CF code that you're using to call it with to help you out.

On May 24, 2011 11:15 PM, "JP Revel" <jp.r...@gmail.com> wrote:



--
E: mark....@gmail.com
T: http://www.twitter.com/neurotic
W: www.compoundtheory.com

cf.Objective(ANZ) - Nov 17, 18 - Melbourne Australia
http://www.cfobjective.com.au

Hands-on ColdFusion ORM Training
www.ColdFusionOrmTraining.com

JP Revel

unread,
May 25, 2011, 12:50:15 AM5/25/11
to javaloader-dev
Thanks so much guys - in the middle of coyping and pasting the code, I
found out the problem - the class was expecting another class that was
in the package. Idiot at the wheel created a jar with only one class
in it.

Now that I have a reference to the object, can you call methods on it
like symbol.setPrice(100000); (assuming there is a setPrice() method
in the java object?)



On May 24, 11:04 pm, Mark Mandel <mark.man...@gmail.com> wrote:
> Also looks like a nasty exception that is deeply nested.
>
> Wrap your code in a try/catch and dump the exception, and paste that up here
> too. CF can hide real errors often to.
>
> You will probably find a 'Caused by:' clauses 3 levels down that will tell
> you what is really going on.
>
> Mark
>
> On Wed, May 25, 2011 at 1:45 PM, Todd Sharp <cfsile...@gmail.com> wrote:
> > We would need to see the java code and the CF code that you're using to
> > call it with to help you out.
> >  On May 24, 2011 11:15 PM, "JP Revel" <jp.re...@gmail.com> wrote:
>
> --
> E: mark.man...@gmail.com

todd sharp

unread,
May 25, 2011, 12:51:43 AM5/25/11
to javaloa...@googlegroups.com
Dump it out with cfdump and you'll see all the available methods.
--
Todd Sharp
Sharp Interactive, LLC
http://slidesix.com -- Multimedia Enabled Presentation Sharing
IM:  cfsi...@gmail.com
Blog:  http://cfsilence.com
Twitter: @cfsilence | @slidesix

Mark Mandel

unread,
May 25, 2011, 12:52:34 AM5/25/11
to javaloa...@googlegroups.com
Interact with the Java object just as you would in regular CF.

Follows the same rules as here:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-79bb.html

Mark
--
E: mark....@gmail.com
Reply all
Reply to author
Forward
0 new messages