JavaLoader returning a Generic Class instead or correct object

14 views
Skip to first unread message

Randy Merrill

unread,
Jan 10, 2011, 2:28:26 PM1/10/11
to javaloa...@googlegroups.com
I was trying to use the javaloader with the mongodb jar and seem to be only able to get back a java.lang.Class object back.

Here is the code that I was running with the mongo jar in the same directory:

<cfscript>
javaloader = createObject('component','javaloader.JavaLoader').init([ expandPath('./mongo-2.4.jar') ]);
test = javaloader.create('com.mongodb.BasicDBObject').init();
writeDump(getmetadata(test));
</cfscript>

It works for other classes in the jar, but doesn't seem to work for the BasicDBObject class.

Any suggestions?

Leigh

unread,
Jan 10, 2011, 4:13:34 PM1/10/11
to javaloa...@googlegroups.com
I think that is just how getMetaData shows the object. If you dump the class name, it should be correct: com.mongodb.BasicDBObject

ie   WriteDump(test.getClass().name);

-Leigh

--- On Mon, 1/10/11, Randy Merrill <zora...@gmail.com> wrote:

Mark Mandel

unread,
Jan 10, 2011, 4:37:43 PM1/10/11
to javaloa...@googlegroups.com
I think Leigh is correct.

What happens if you just do:

writeDump(test);

?

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

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

Hands-on ColdFusion ORM Training
www.ColdFusionOrmTraining.com

Randy Merrill

unread,
Jan 10, 2011, 4:44:39 PM1/10/11
to javaloa...@googlegroups.com
You are correct. If I run the writeDump(test.getClass().name); I get the correct response.

Thanks!
Reply all
Reply to author
Forward
0 new messages