Instantiation of Java objects happens at the first method call, NOT at
the createObject call.  The reason is so that you can call the init()
method with parameters, which in turn calls the constructor.  So a
"proper" java object instantiation looks like this:

<cfset obj = createObject("java", "java.lang.String").init() />

The .init() is optional if you don't have parameters to pass, though
it will be called implicitly on the first method call, NOT on the
createObject call, so I'd recommend always passing it.

Now that that's out of the way, I bet the problem you're having is
that your class isn't being found.  It must be added to the CF class
path, as configured in the JVM settings page of the CF admin.

cheers,
barneyb

On Wed, 26 Jan 2005 18:21:23 -0400, Barrett Nuzum
<[EMAIL PROTECTED]> wrote:
> Hi gang.
> 
> We've got a ColdFusion 5.1 server, and we're trying to add some functionality 
> using Java objects and the CFOBJECT tag.
> 
> Now, I've got two classes that I've written, and seem to work fine. If I 
> execute them as Java Applications on my localhost, they run ***perfectly***.
> 
> On the CF server, though, the Java Object is created successfully, but as 
> soon as I try to execute a method, I get the following error:
>  java.lang.NullPointerException. Java exception occurred in call to method.
> 
> Now the Java class itself has full Exception handling and passes error 
> messages back in it's result String, so clearly the method isn't able to run 
> at all.
> 
> However, I don't understand why this would be occuring at all -- it won't 
> even tell me, for example, that the signature of the method I'm trying to 
> execute doesn't match the class. (Which might make sense, but I have no idea 
> how to tell which and how. I have checked the parameters a hundred times, and 
> they should, as far as I know, match. Whether Java agrees is another matter.)
> 
> I've torn out what little hair I had left.
> 
> If anyone has advice as to how to debug this application further, it would be 
> appreciated more than you'll ever be able to know.
> 
> Thanks in advance.
> 
> Barrett
> 
> 

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 7 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191905
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to