0
Explorer
,
/t5/coldfusion-discussions/calling-static-methods/td-p/581075
May 29, 2007
May 29, 2007
Copy link to clipboard
Copied
Hi,
I have a problem with calling static methods after creating a object:
I am using coldfusion 7.0 and this is my code:
When I am using either <cfobject> or createObject the same
<cfobject action="create" type="java" class="com.endeca.navigation.ENEQueryToolkit" name="new_N">
<cfset new_N = createObject("java", "com.endeca.navigation.ENEQueryToolkit")>
<cfdump var = "#new_N#">
<cfset new_N = new_N.selectRefinement(#my_nav_results#, toString(sample_refinement_value))>
1. CFDUMP tells me that object [unknown type] and [unable to convert to string]
2. When I call a static method new_N.selectRefinement(...) i get "The selected method selectRefinement was not found."
3. Arguments to selectRefinement() method are of correct datatype
Below are all methods of this class (all are static):
static boolean isImplicitRefinement(Dimension dim, DimVal refinement)
static DimValIdList removeDescriptor(Navigation n, DimVal descriptor)
static DimValIdList selectAncestor(Navigation n, DimVal ancestor, DimVal descriptor)
static DimValIdList selectRefinement(Navigation n, DimVal refinement)
Any suggestions?
Thank You
I have a problem with calling static methods after creating a object:
I am using coldfusion 7.0 and this is my code:
When I am using either <cfobject> or createObject the same
<cfobject action="create" type="java" class="com.endeca.navigation.ENEQueryToolkit" name="new_N">
<cfset new_N = createObject("java", "com.endeca.navigation.ENEQueryToolkit")>
<cfdump var = "#new_N#">
<cfset new_N = new_N.selectRefinement(#my_nav_results#, toString(sample_refinement_value))>
1. CFDUMP tells me that object [unknown type] and [unable to convert to string]
2. When I call a static method new_N.selectRefinement(...) i get "The selected method selectRefinement was not found."
3. Arguments to selectRefinement() method are of correct datatype
Below are all methods of this class (all are static):
static boolean isImplicitRefinement(Dimension dim, DimVal refinement)
static DimValIdList removeDescriptor(Navigation n, DimVal descriptor)
static DimValIdList selectAncestor(Navigation n, DimVal ancestor, DimVal descriptor)
static DimValIdList selectRefinement(Navigation n, DimVal refinement)
Any suggestions?
Thank You
TOPICS
Advanced techniques
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
Explorer
,
May 30, 2007
May 30, 2007
After reading
http://www.bennadel.com/index.cfm?dax=blog:737.view
and all related articles i found a solution to the problem: Below
is a code that works. First <cfdump> does not give any
meaningful results but second <cfdump> after calling static
method returns correct value. The problem was with second parameter
instead #sample_refinement_value# i had
toSring(sample_refinement_value) which caused the error :
Thank you all for the input and suggestions.
<cfset new_N = createObject("java", "com....
Thank you all for the input and suggestions.
<cfset new_N = createObject("java", "com....
Advocate
,
/t5/coldfusion-discussions/calling-static-methods/m-p/581076#M53544
May 29, 2007
May 29, 2007
Copy link to clipboard
Copied
First, you don't have to use both createObject() and
<cfobject> - one or the other will suffice (personally, I
prefer CreateObject()).
Second, are you sure you have set up the java files correctly in your CF administrator / classpath? If you have the following code should show you SOMETHING:
<cfset new_N = createObject("java", "com.endeca.navigation.ENEQueryToolkit")>
<cfdump var="#new_N#">
Until you can get the above code working, your object is not loaded correctly in CF.
Second, are you sure you have set up the java files correctly in your CF administrator / classpath? If you have the following code should show you SOMETHING:
<cfset new_N = createObject("java", "com.endeca.navigation.ENEQueryToolkit")>
<cfdump var="#new_N#">
Until you can get the above code working, your object is not loaded correctly in CF.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
marekss
AUTHOR
Explorer
,
/t5/coldfusion-discussions/calling-static-methods/m-p/581078#M53546
May 29, 2007
May 29, 2007
Copy link to clipboard
Copied
I have been using createOject() and my .jar files are in
C:\CFusionMX7\lib . I assume that is correct because I successfully
created objects and called non-static methods on them. Schould
<cfdump> print all methods that are assosiated with this
class even though all methods are static? My cfdump output is
clickable box with object [unknown type].
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guide
,
/t5/coldfusion-discussions/calling-static-methods/m-p/581077#M53545
May 29, 2007
May 29, 2007
Copy link to clipboard
Copied
I agree with insuractive. You need to resolve the
createObject() problem first.
>static DimValIdList selectRefinement(Navigation n, DimVal refinement)
Then make sure you're passing in the correct object types. Is #my_nav_results# an instance of "Navigation" and #sample_refinement_value# an instance of "DimVal"? In any case I don't think you need the toString(..) call.
>static DimValIdList selectRefinement(Navigation n, DimVal refinement)
Then make sure you're passing in the correct object types. Is #my_nav_results# an instance of "Navigation" and #sample_refinement_value# an instance of "DimVal"? In any case I don't think you need the toString(..) call.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guide
,
/t5/coldfusion-discussions/calling-static-methods/m-p/581079#M53547
May 29, 2007
May 29, 2007
Copy link to clipboard
Copied
Yes, placing the jar in C:\CFusionMX7\lib an rebooting is
fine.
If the object is valid, Cfdump should print all of its public methods. I don't know if it prints protected or private methods. I thought the cfdump box was expanded by default.. but if you click the box does it show the method names?
If the object is valid, Cfdump should print all of its public methods. I don't know if it prints protected or private methods. I thought the cfdump box was expanded by default.. but if you click the box does it show the method names?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
marekss
AUTHOR
Explorer
,
/t5/coldfusion-discussions/calling-static-methods/m-p/581080#M53548
May 29, 2007
May 29, 2007
Copy link to clipboard
Copied
There are only static methods in this class. My first post
lists ALL methods this class contains, there aren't any public or
private methods.
I am passing correct object types, first argument is of type Navigation and second of DimVal
I am passing correct object types, first argument is of type Navigation and second of DimVal
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
marekss
AUTHOR
Explorer
,
/t5/coldfusion-discussions/calling-static-methods/m-p/581081#M53549
May 29, 2007
May 29, 2007
Copy link to clipboard
Copied
When I click on the <cfdump> box instead of methods i
see [unable to convert to string] on top section of cfdump box I
see object [unknown type]. I have read on lifedocs that in order to
call static methods i just have to instantiate object and then call
static methods. For other methods (public, or private) I have to
use init() to initialize the object. I have tested with and without
initialization and it was unsuccessful.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
LEGEND
,
/t5/coldfusion-discussions/calling-static-methods/m-p/581082#M53550
May 30, 2007
May 30, 2007
Copy link to clipboard
Copied
This might help:
http://www.bennadel.com/index.cfm?dax=blog:737.view
If not the article itself, then the links within in.
--
Adam
http://www.bennadel.com/index.cfm?dax=blog:737.view
If not the article itself, then the links within in.
--
Adam
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Explorer
,
/t5/coldfusion-discussions/calling-static-methods/m-p/581083#M53551
May 30, 2007
May 30, 2007
Copy link to clipboard
Copied
After reading
http://www.bennadel.com/index.cfm?dax=blog:737.view
and all related articles i found a solution to the problem: Below
is a code that works. First <cfdump> does not give any
meaningful results but second <cfdump> after calling static
method returns correct value. The problem was with second parameter
instead #sample_refinement_value# i had
toSring(sample_refinement_value) which caused the error :
Thank you all for the input and suggestions.
<cfset new_N = createObject("java", "com.endeca.navigation.ENEQueryToolkit")>
<cfdump var = "#new_N#">
<cfset new_N = new_N.selectRefinement(#my_nav_results#, #sample_refinement_value#)>
<cfdump var = "#new_N#">
Thank you all for the input and suggestions.
<cfset new_N = createObject("java", "com.endeca.navigation.ENEQueryToolkit")>
<cfdump var = "#new_N#">
<cfset new_N = new_N.selectRefinement(#my_nav_results#, #sample_refinement_value#)>
<cfdump var = "#new_N#">
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Guide
,
LATEST
/t5/coldfusion-discussions/calling-static-methods/m-p/581084#M53552
May 30, 2007
May 30, 2007
Copy link to clipboard
Copied
I knew you didn't need that toString(..) call 😉 Glad its
working for you now.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

