[cfaussie] Re: Call Java Class (Java Code Attached)
Frankly, I think you should get the Java guys to write you a wrapper class. I think Mark is right, the problem is with the class. Darryl On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Actually, Once I replaced the script for cfscript It still cant seem to find a Constructor. Error Occurred While Processing Request Unable to find a constructor for class IceKey that accepts parameters of type ( java.lang.Integer ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfscript 2 : myObj = createObject(java, IceKey).init(javaCast(int, 2)); 3 : /cfscript Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 16:05 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) I have little Java knowledge, I don't want to learn how to do it. I just want to implement something from it in ColdFusion. Unfortunatley that is one and the same - you can't 'just do something' without first understanding it to a degree. Your help has been great, why doesn't it explain this in the manuals / docs. It does explain this in the docs - however there is a reasonable assumption that when working with Java, you have an understanding of Java. It is not the responsibility of CF documentation to teach you basic Java and OO concepts. .init(javaCast(int, 2)); I didn't check the docs, I did it off the top of my head, so that looks correct. Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Mark, I'll give it a try. It seems to me that you are trying to run here, without first learning how to walk - you obviously have very minimal knowledge of Java as a whole. I would highly suggest doing some training and/or reading about Java and OO concepts before continuing down this path. You will find it far easier in the long run. Your help has been great, why doesn't it explain this in the manuals / docs. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 15:50 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) You will need to do - createObject(java, IceKey).init(javaCast(1, init)); Which will insure the parameter passed to the constructor is an actual int, not a Integer object. I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? It seems to me that you are trying to run here, without first learning how to walk - you obviously have very minimal knowledge of Java as a whole. I would highly suggest doing some training and/or reading about Java and OO concepts before continuing down this path. You will find it far easier in the long run. Regards, Mark -- E: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
Actually - what just popped into my head - Try this - cfscript myObj = createObject(java, IceKey).init();/cfscript I have found on occasion you actually need to explicitly call the default constructor on the Java object, otherwise you get weirdness.I'm not really sure why it is, I have a feeling it may have something to do with static attributes - therefore I tend to call init() on all constructors by default. Try that, and see if that works.MarkOn 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Ok,It's called IceKey.java a ICE encryption class off the net.We use this here in Java land, and I want to get it working for CF. The main three methodsSet Set KeyEncrypt Encrypt DataDecrypt Decrypt DataRegardsDale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 09:08 AM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class Can we see the Java Code? I'm running out of ideas why this isn't working for you... Mark On 3/20/06, Dale Fraser [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Error Occurred While Processing Request IceKey The error occurred in D:\Tools\Web\test.cfm: line 29 27 : 28 :cfif NOT Arguments.isMetadata 29 :cfset class = Arguments.Object.getClass() 30 :cfelse 31 :cfset class = Arguments.Object Regards Dale Fraser -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 -- E: [EMAIL PROTECTED]W: www.compoundtheory.comICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
Hey, I'm no Java guru, but I don't see a constructor class or init method in this function. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:02 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) Actually - what just popped into my head - Try this - cfscript myObj = createObject(java, IceKey).init(); /cfscript I have found on occasion you actually need to explicitly call the default constructor on the Java object, otherwise you get weirdness. I'm not really sure why it is, I have a feeling it may have something to do with static attributes - therefore I tend to call init() on all constructors by default. Try that, and see if that works. Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Ok, It's called IceKey.java a ICE encryption class off the net. We use this here in Java land, and I want to get it working for CF. The main three methods Set Set Key Encrypt Encrypt Data Decrypt Decrypt Data Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 09:08 AM To: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class Can we see the Java Code? I'm running out of ideas why this isn't working for you... Mark On 3/20/06, Dale Fraser [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Error Occurred While Processing Request IceKey The error occurred in D:\Tools\Web\test.cfm: line 29 27 : 28 :cfif NOT Arguments.isMetadata 29 :cfset class = Arguments.Object.getClass() 30 :cfelse 31 :cfset class = Arguments.Object Regards Dale Fraser -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
To copy paste out of the coldfusion documentation:http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentationfile=part_dev.htm Invoking objectsThe cfobject tag makes Java objects available in ColdFusionMX. It can access any Java class that is available on the JVM classpath or in either of the following locations: In a Java archive (.jar) file in web_root/WEB-INF/lib In a class (.class) file in web_root/WEB-INF/classes For example:cfobject type=Java class=MyClass name=myObjAlthough the cfobject tag loads the class, it does not create an instance object. Only static methods and fields are accessible immediately after the call to cfobject. If you call a public non-static method on the object without first calling the init method, there ColdFusion makes an implicit call to the default constructor.To call an object constructor explicitly, use the special ColdFusion init method with the appropriate arguments after you use the cfobject tag; for example:cfobject type=Java class=MyClass name=myObjcfset ret=myObj.init(arg1, arg2)Note: The init method is not a method of the object, but a ColdFusion identifier that calls the new function on the class constructor. So, if a Java object has an init method, a name conflict exists and you cannot call the object's init method.To have persistent access to an object, you must use the init function, because it returns a reference to an instance of the object, and cfobject does not.An object created using cfobject or returned by other objects is implicitly released at the end of the ColdFusion page execution. Btw - you may want to brush up on your OO vocabulary. I think you meant to say you could 'not find a init method in this class' or something to that effect.MarkOn 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Hey,I'm no Java guru, but I don't see a constructor class or init method in thisfunction.RegardsDale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:02 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) Actually - what just popped into my head - Try this - cfscript myObj = createObject(java, IceKey).init(); /cfscript I have found on occasion you actually need to explicitly call the default constructor on the Java object, otherwise you get weirdness. I'm not really sure why it is, I have a feeling it may have something to do with static attributes - therefore I tend to call init() on all constructors by default. Try that, and see if that works. Mark-- E: [EMAIL PROTECTED]W: www.compoundtheory.com ICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
This cfobject action=create type=java class=IceKey name=myObj / cfset ret=myObj.init() / cfdump var=#myObj# / Gives this Error Occurred While Processing Request Unable to find a constructor for class IceKey that accepts parameters of type ( ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfobject action=create type=java class=IceKey name=myObj / 2 : cfset ret=myObj.init() / 3 : cfdump var=#me# / Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:42 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) To copy paste out of the coldfusion documentation: http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common /html/wwhelp.htm?context=ColdFusion_Documentationfile=part_dev.htm Invoking objects The cfobject tag makes Java objects available in ColdFusion MX. It can access any Java class that is available on the JVM classpath or in either of the following locations: * In a Java archive (.jar) file in web_root/WEB-INF/lib * In a class (.class) file in web_root/WEB-INF/classes For example: cfobject type=Java class=MyClass name=myObj Although the cfobject http://livedocs.macromedia.com/coldfusion/7/htmldocs/0302.htm#2820239 tag loads the class, it does not create an instance object. Only static methods and fields are accessible immediately after the call to cfobject. If you call a public non-static method on the object without first calling the init method, there ColdFusion makes an implicit call to the default constructor. To call an object constructor explicitly, use the special ColdFusion init method with the appropriate arguments after you use the cfobject tag; for example: cfobject type=Java class=MyClass name=myObj cfset ret=myObj.init(arg1, arg2) Note: The init method is not a method of the object, but a ColdFusion identifier that calls the new function on the class constructor. So, if a Java object has an init method, a name conflict exists and you cannot call the object's init method. To have persistent access to an object, you must use the init function, because it returns a reference to an instance of the object, and cfobject does not. An object created using cfobject or returned by other objects is implicitly released at the end of the ColdFusion page execution. Btw - you may want to brush up on your OO vocabulary. I think you meant to say you could 'not find a init method in this class' or something to that effect. Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Hey, I'm no Java guru, but I don't see a constructor class or init method in this function. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:02 PM To: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) Actually - what just popped into my head - Try this - cfscript myObj = createObject(java, IceKey).init(); /cfscript I have found on occasion you actually need to explicitly call the default constructor on the Java object, otherwise you get weirdness. I'm not really sure why it is, I have a feeling it may have something to do with static attributes - therefore I tend to call init() on all constructors by default. Try that, and see if that works. Mark -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
That's because the class doesn't have a no-arguments constructor. You need to provide an int argument level.BlairOn 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote:This cfobject action="" type=java class=IceKey name=myObj /cfset ret=myObj.init() /cfdump var=#myObj# /Gives this Error Occurred While Processing RequestUnable to find a constructor for class IceKey that accepts parameters oftype ( ).The error occurred in D:\Tools\Web\test.cfm: line 21 : cfobject action="" type=java class=IceKey name=myObj / 2 : cfset ret=myObj.init() /3 : cfdump var=#me# /RegardsDale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:42 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) To copy paste out of the coldfusion documentation: http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common /html/wwhelp.htm?context=ColdFusion_Documentationfile=part_dev.htm Invoking objects The cfobject tag makes Java objects available in ColdFusion MX. It can access any Java class that is available on the JVM classpath or in either of the following locations: * In a Java archive (.jar) file in web_root/WEB-INF/lib * In a class (.class) file in web_root/WEB-INF/classes For example: cfobject type=Java class=MyClass name=myObj Although the cfobject http://livedocs.macromedia.com/coldfusion/7/htmldocs/0302.htm#2820239 tag loads the class, it does not create an instance object. Only static methods and fields are accessible immediately after the call to cfobject. If you call a public non-static method on the object without first calling the init method, there ColdFusion makes an implicit call to the default constructor. To call an object constructor explicitly, use the special ColdFusion init method with the appropriate arguments after you use the cfobject tag; for example: cfobject type=Java class=MyClass name=myObj cfset ret=myObj.init(arg1, arg2) Note: The init method is not a method of the object, but a ColdFusion identifier that calls the new function on the classconstructor. So, if a Java object has an init method, a name conflict exists and you cannot call the object's init method. To have persistent access to an object, you must use the init function, because it returns a reference to an instance of the object, and cfobject does not. An object created using cfobject or returned by other objects is implicitly released at the end of the ColdFusion page execution. Btw - you may want to brush up on your OO vocabulary.I think you meant to say you could 'not find a init method in this class' or something to that effect. Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Hey, I'm no Java guru, but I don't see a constructor class or init method in this function. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:02 PM To: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) Actually - what just popped into my head - Try this - cfscript myObj = createObject(java, IceKey).init(); /cfscript I have found on occasion you actually need to explicitly call the default constructor on the Java object, otherwise you get weirdness. I'm not really sure why it is, I have a feeling it may have something to do with static attributes - therefore I tend to call init() on all constructors by default. Try that, and see if that works. Mark -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
What does that mean in english. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Shib71 Sent: Tuesday, 21 March 2006 14:07 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) That's because the class doesn't have a no-arguments constructor. You need to provide an int argument level. Blair On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: This cfobject action=create type=java class=IceKey name=myObj / cfset ret=myObj.init() / cfdump var=#myObj# / Gives this Error Occurred While Processing Request Unable to find a constructor for class IceKey that accepts parameters of type ( ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfobject action=create type=java class=IceKey name=myObj / 2 : cfset ret=myObj.init() / 3 : cfdump var=#me# / Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:42 PM To: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) To copy paste out of the coldfusion documentation: http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/commo n /html/wwhelp.htm?context=ColdFusion_Documentationfile=part_dev.htm Invoking objects The cfobject tag makes Java objects available in ColdFusion MX. It can access any Java class that is available on the JVM classpath or in either of the following locations: * In a Java archive (.jar) file in web_root/WEB- INF/lib * In a class (.class) file in web_root/WEB-INF/classes For example: cfobject type=Java class=MyClass name=myObj Although the cfobject http://livedocs.macromedia.com/coldfusion/7/htmldocs/0302.htm#2820239 tag loads the class, it does not create an instance object. Only static methods and fields are accessible immediately after the call to cfobject. If you call a public non-static method on the object without first calling the init method, there ColdFusion makes an implicit call to the default constructor. To call an object constructor explicitly, use the special ColdFusion init method with the appropriate arguments after you use the cfobject tag; for example: cfobject type=Java class=MyClass name=myObj cfset ret=myObj.init(arg1, arg2) Note: The init method is not a method of the object, but a ColdFusion identifier that calls the new function on the class constructor. So, if a Java object has an init method, a name conflict exists and you cannot call the object's init method. To have persistent access to an object, you must use the init function, because it returns a reference to an instance of the object, and cfobject does not. An object created using cfobject or returned by other objects is implicitly released at the end of the ColdFusion page execution. Btw - you may want to brush up on your OO vocabulary. I think you meant to say you could 'not find a init method in this class' or something to that effect. Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Hey, I'm no Java guru, but I don't see a constructor class or init method in this function. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:02 PM To: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) Actually - what just popped into my head - Try this - cfscript myObj = createObject(java, IceKey).init(); /cfscript I have found on occasion you actually need to explicitly
[cfaussie] Re: Call Java Class (Java Code Attached)
In Java it is possible to create custom constructors for a class. Often these constructors don't take any arguments, but occassionally you come up against a class that needs parameters to initialize properly. In those cases the class's constructors will require arguments: ie using init() will be invalid.In your case this code is valid:cfscript myObj = createObject(java, IceKey).init(3 );/cfscriptbut this isn't: cfscript myObj = createObject(java, IceKey).init(); /cfscriptFor future reference, a Java class's constructor method has the same name as the class. If you think the constructor (init) might require arguments, you can look through the source code for that method. BTW I have no idea what the argument is for, or whether 3 is a good value.CheersBlairOn 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote:What does that mean in english.Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com ] On Behalf Of Shib71 Sent: Tuesday, 21 March 2006 14:07 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) That's because the class doesn't have a no-arguments constructor. You need to provide an int argument level. Blair On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: This cfobject action="" type=java class=IceKey name=myObj / cfset ret= myObj.init() / cfdump var=#myObj# / Gives this Error Occurred While Processing Request Unable to find a constructor for class IceKey that accepts parameters of type ( ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfobject action="" type=java class=IceKey name=myObj / 2 : cfset ret=myObj.init() / 3 : cfdump var=#me# / Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com [mailto:cfaussie@googlegroups.com] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:42 PM To: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) To copy paste out of the coldfusion documentation: http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/commo n /html/wwhelp.htm?context=ColdFusion_Documentationfile=part_dev.htm Invoking objects The cfobject tag makes Java objects available in ColdFusion MX. It can access any Java class that is available on the JVM classpath or in either of the following locations: * In a Java archive (.jar) file in web_root/WEB- INF/lib * In a class (.class) file in web_root/WEB-INF/classes For example: cfobject type=Java class=MyClass name=myObj Although the cfobject http://livedocs.macromedia.com/coldfusion/7/htmldocs/0302.htm#2820239 tag loads the class, it does not create an instance object. Only static methods and fields are accessible immediately after the call to cfobject. If you call a public non-static method on the object without first calling the init method, there ColdFusion makes an implicit call to the default constructor. To call an object constructor explicitly, use the special ColdFusion init method with the appropriate arguments after you use the cfobject tag; for example: cfobject type=Java class=MyClass name=myObj cfset ret=myObj.init(arg1, arg2) Note: The init method is not a method of the object, but a ColdFusion identifier that calls the new function on the class constructor. So, if a Java object has an init method, a name conflict exists and you cannot call the object's init method. To have persistent access to an object, you must use the init function, because it returns a reference to an instance of the object, and cfobject does not. An object created using cfobject or returned by other objects is implicitly released at the end of the ColdFusion page execution.Btw - you may want to brush up on your OO vocabulary.I think you meant to say you could 'not find a init method in this class' or something to that effect. Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote:Hey, I'm no Java guru, but I don't see a constructor class or init method in this function. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com mailto: cfaussie@googlegroups.commailto:cfaussie@googlegroups.com [mailto: cfaussie@googlegroups.com] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 13:02 PM To: cfaussie@googlegroups.com mailto:cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) Actually - what just popped into my head - Try this - cfscript myObj = createObject(java, IceKey).init(); /cfscript I have found on occasion you actually need to explicitly call the default constructor on the Java object, otherwise you get weirdness. I'm not really sure why it is, I have a feeling it may have something to do with static attribute
[cfaussie] Re: Call Java Class (Java Code Attached)
Mark, I'll give it a try. It seems to me that you are trying to run here, without first learning how to walk - you obviously have very minimal knowledge of Java as a whole. I would highly suggest doing some training and/or reading about Java and OO concepts before continuing down this path. You will find it far easier in the long run. I have little Java knowledge, I don't want to learn how to do it. I just want to implement something from it in ColdFusion. Your help has been great, why doesn't it explain this in the manuals / docs. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 15:50 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) You will need to do - createObject(java, IceKey).init(javaCast(1, init)); Which will insure the parameter passed to the constructor is an actual int, not a Integer object. I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? It seems to me that you are trying to run here, without first learning how to walk - you obviously have very minimal knowledge of Java as a whole. I would highly suggest doing some training and/or reading about Java and OO concepts before continuing down this path. You will find it far easier in the long run. Regards, Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: For future reference, a Java class's constructor method has the same name as the class. If you think the constructor (init) might require arguments, you can look through the source code for that method. I was aware of this, but didn't see that method, used to it being at the top I guess. Anyway, still can't get it working. Unable to find a constructor for class IceKey that accepts parameters of type ( java.lang.Integer ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfobject action=create type=java class=IceKey name=myObj / 2 : cfset ret = myObj.init(asc()) / 3 : cfdump var=#myObj# / I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? Regards Dale Fraser -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
Was that supposed to be .init(javaCast(2, int)); Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 15:50 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) You will need to do - createObject(java, IceKey).init(javaCast(1, init)); Which will insure the parameter passed to the constructor is an actual int, not a Integer object. I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? I'm sorry, but this really upsets me Dale. Integeration with Java IS easy if you understand both Java and ColdFusion. Walking up to Java blind and asking it to play nicely with ColdFusion without even a basic understanding of Java concepts and then wondering why it won't work seems to me to be a bit rediculous, don't you think? It seems to me that you are trying to run here, without first learning how to walk - you obviously have very minimal knowledge of Java as a whole. I would highly suggest doing some training and/or reading about Java and OO concepts before continuing down this path. You will find it far easier in the long run. Regards, Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: For future reference, a Java class's constructor method has the same name as the class. If you think the constructor (init) might require arguments, you can look through the source code for that method. I was aware of this, but didn't see that method, used to it being at the top I guess. Anyway, still can't get it working. Unable to find a constructor for class IceKey that accepts parameters of type ( java.lang.Integer ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfobject action=create type=java class=IceKey name=myObj / 2 : cfset ret = myObj.init(asc()) / 3 : cfdump var=#myObj# / I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? Regards Dale Fraser -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
Actually, .init(javaCast(int, 2)); Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 15:50 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) You will need to do - createObject(java, IceKey).init(javaCast(1, init)); Which will insure the parameter passed to the constructor is an actual int, not a Integer object. I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? I'm sorry, but this really upsets me Dale. Integeration with Java IS easy if you understand both Java and ColdFusion. Walking up to Java blind and asking it to play nicely with ColdFusion without even a basic understanding of Java concepts and then wondering why it won't work seems to me to be a bit rediculous, don't you think? It seems to me that you are trying to run here, without first learning how to walk - you obviously have very minimal knowledge of Java as a whole. I would highly suggest doing some training and/or reading about Java and OO concepts before continuing down this path. You will find it far easier in the long run. Regards, Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: For future reference, a Java class's constructor method has the same name as the class. If you think the constructor (init) might require arguments, you can look through the source code for that method. I was aware of this, but didn't see that method, used to it being at the top I guess. Anyway, still can't get it working. Unable to find a constructor for class IceKey that accepts parameters of type ( java.lang.Integer ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfobject action=create type=java class=IceKey name=myObj / 2 : cfset ret = myObj.init(asc()) / 3 : cfdump var=#myObj# / I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? Regards Dale Fraser -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
if that's pasted code, then your problem might be that the tag should be cfscript, not script On 21/03/2006, at 4:06 PM, Dale Fraser wrote: Ok, This script myObj = createObject(java, IceKey).init(javaCast(int, 2)); /script cfdump var=#myObj# / GETS Error Occurred While Processing Request Variable MYOBJ is undefined. The error occurred in D:\Tools\Web\test.cfm: line 5 3 : /script 4 : 5 : cfdump var=#myObj# / So I'm at another dead end. Regards Dale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 15:50 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) You will need to do - createObject(java, IceKey).init(javaCast(1, init)); Which will insure the parameter passed to the constructor is an actual int, not a Integer object. I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? I'm sorry, but this really upsets me Dale. Integeration with Java IS easy if you understand both Java and ColdFusion. Walking up to Java blind and asking it to play nicely with ColdFusion without even a basic understanding of Java concepts and then wondering why it won't work seems to me to be a bit rediculous, don't you think? It seems to me that you are trying to run here, without first learning how to walk - you obviously have very minimal knowledge of Java as a whole. I would highly suggest doing some training and/or reading about Java and OO concepts before continuing down this path. You will find it far easier in the long run. Regards, Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: For future reference, a Java class's constructor method has the same name as the class. If you think the constructor (init) might require arguments, you can look through the source code for that method. I was aware of this, but didn't see that method, used to it being at the top I guess. Anyway, still can't get it working. Unable to find a constructor for class IceKey that accepts parameters of type ( java.lang.Integer ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfobject action=create type=java class=IceKey name=myObj / 2 : cfset ret = myObj.init(asc()) / 3 : cfdump var=#myObj# / I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? Regards Dale Fraser -- E: [EMAIL PROTECTED] W: www.compoundtheory.com ICQ: 3094740 --- Life is poetry, write it in your own words --- Toby Tremayne Senior Technical Consultant Lyricist Software 0416 048 090 ICQ: 13107913 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---
[cfaussie] Re: Call Java Class (Java Code Attached)
Somehow either your constructor is returning null, which is weird, or you've written 'myObj' funny somehow.I'm not sure what you have done.MarkOn 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: Ok, ThisscriptmyObj = createObject(java, IceKey).init(javaCast(int, 2));/scriptcfdump var=#myObj# /GETS Error Occurred While Processing RequestVariable MYOBJ is undefined.The error occurred in D:\Tools\Web\test.cfm: line 53 : /script4 :5 : cfdump var=#myObj# / So I'm at another dead end.RegardsDale Fraser -Original Message- From: cfaussie@googlegroups.com [mailto: cfaussie@googlegroups.com] On Behalf Of Mark Mandel Sent: Tuesday, 21 March 2006 15:50 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Call Java Class (Java Code Attached) You will need to do - createObject(java, IceKey).init(javaCast(1, init)); Which will insure the parameter passed to the constructor is an actual int, not a Integer object. I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? I'm sorry, but this really upsets me Dale.Integeration with Java IS easy if you understand both Java and ColdFusion. Walking up to Java blind and asking it to play nicely with ColdFusion without even a basic understanding of Java concepts and then wondering why it won't work seems to me to be a bit rediculous, don't you think? It seems to me that you are trying to run here, without first learning how to walk - you obviously have very minimal knowledge of Java as a whole.I would highly suggest doing some training and/or reading about Java and OO concepts before continuing down this path.You will find it far easier in the long run. Regards, Mark On 3/21/06, Dale Fraser [EMAIL PROTECTED] wrote: For future reference, a Java class's constructor method has the same name as the class. If you think the constructor (init) might require arguments, you can look through the source code for that method. I was aware of this, but didn't see that method, used to it being at the top I guess. Anyway, still can't get it working. Unable to find a constructor for class IceKey that accepts parameters of type ( java.lang.Integer ). The error occurred in D:\Tools\Web\test.cfm: line 2 1 : cfobject action="" type=java class=IceKey name=myObj / 2 : cfset ret = myObj.init(asc()) / 3 : cfdump var=#myObj# / I tried, just 1 it said didn't like strings, tried int(1) said it didn't like doubles, damm I hate this, wasn't CF / Java talking supposed to be easy? Regards Dale Fraser W: www.compoundtheory.comICQ: 3094740 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfaussie -~--~~~~--~~--~--~---