Re: ColdFusion 5 and Java Object Instantiation

2005-01-26 Thread Barney Boisvert
The point of my first email was that in reality, nothing happens when
you call createObject.  The object isn't instantiated until the first
method call.  All that happens with createObject is that CF makes the
assumption that it will probably need to instantiate the named class
at some point in the future.

o = createObject("java", "java.lang.String");
o.toString();

On the first line, nothing happens.  On the second line, the object is
instantiated, the default constructor is called (an implicit init()
call with no args), and then the toString() method is called.

Does the stack trace tell you any more about the cause of the NPE?  Is
your class listed anywhere in there?  Because if you can get
HelloWorld to run, then it's most likely something in you custom class
that's causing the problem.

cheers,
barneyb


On Wed, 26 Jan 2005 23:04:12 -0400, Barrett Nuzum
<[EMAIL PROTECTED]> wrote:
> Thanks for the response, Barney.
> 
> >Instantiation of Java objects happens at the first method call, NOT at
> >the createObject call.
> 
> I misspoke. I'm instantiating with createObject, and then it barfs when I 
> perform the method call.
> 
> >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.
> 
> CreateObject is running successfully, though, and other classes (Hello, 
> World-type stuff) runs fine in the same directory.
> 
> I wrangled for some time with a ClassNotFound error. This is definitely NOT 
> that.
> 
> Barrett
> 

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

Got Gmail? I have 7 invites.

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191909
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


Re: ColdFusion 5 and Java Object Instantiation

2005-01-26 Thread Barrett Nuzum
Thanks for the response, Barney.

>Instantiation of Java objects happens at the first method call, NOT at
>the createObject call.  

I misspoke. I'm instantiating with createObject, and then it barfs when I 
perform the method call.

>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.

CreateObject is running successfully, though, and other classes (Hello, 
World-type stuff) runs fine in the same directory.

I wrangled for some time with a ClassNotFound error. This is definitely NOT 
that.

Barrett

~|
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:191908
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


Re: ColdFusion 5 and Java Object Instantiation

2005-01-26 Thread Barney Boisvert
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:



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


ColdFusion 5 and Java Object Instantiation

2005-01-26 Thread Barrett Nuzum
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

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191901
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54