Passing Variables to a Dot Net class results in ambiguous errors

Previously I wrote a little about how I was struggling to connect a dotnet component with Coldfusion. After some wrestling I was able to create the object in coldfusion and see its methods.

The next step, of course, is to actually do something with it. With this app, the goal is to open cad files and retrieve information about them. When I look at the class reference, all the methods I need are there, and when I look at the dump of the class, all the methods are there. We’re on the way.

Here you can see the OpenDesign method. It takes 2 arguments - the filename and an integer to determine the type of access.

So, here we go.  My object is called cadx.  I’m going got set the filename, hand that off to the component, and see what happens!


<cfset thisfile="1571269P01R01_ARTIOS.ARD">
<cfset thispath=getDirectoryfromPath(getCurrentTemplatePath())>
<cfset thisfile=thispath & thisfile>
<cfset result=cadx.OpenDesign(thisfile,0)>
<cfdump var="#result#">

And… no dice. But it’s progress. Now I’ve got a *new* error. I guess that’s progress.

Screen Shot 2015-03-24 at 2.48.20 PM

We know that the method exists (see the dump above) but what’s causing the error? Here’s the actual error detail:

Either there are no methods with the specified
method name and argument types or the OpenDesign
method is overloaded with argument types that 
ColdFusion cannot decipher reliably. ColdFusion 
found 0 methods that match the provided arguments. 
If this is a Java object and you verified that
the method exists, use the javacast function 
to reduce ambiguity.

Attempting to redo it, javaCasting the variables, results in the same error.

<cfset result=cadx.OpenDesign(JavaCast("string",thisfile),JavaCast("short",0))>

Haven’t solved it yet after 8 hours. Headed home and will bang my head against this again in the morning.

Leave a Reply

Your email address will not be published. Required fields are marked *