Error calling a .net object

17 views
Skip to first unread message

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 8:28:53 AM3/25/15
to ColdFusion Technical Talk

I have a problem I wanted to run by the list. I’m recently back in the coldfusion world after a several year hiatus. I’m in the process of trying to access the methods of a .net component, at this point as a proof of concept. Once I can do something with it I’ll actually start building the app.

I set up the object like this:

<cfset dll = ExpandPath('./com/Interop.CADXLib.dll')>
<cfobject
class="CADXLib.CadX"
type=".NET"
name="cadx"
assembly="#dll#”>

That’s in my application.cfc, in the onRequestStart() method. Then in my index.cfm I call:

<cfdump var="#cadx#”>

The object dumps just fine. I can see all the internal methods, including the one I need to get things going, the OpenDesign() method, which (in theory) opens a local file and reads the contents.

So next I set the actual filename I want to access:

<cfset thisfile="1571269P01R01_ARTIOS.ARD">
<cfset thispath=getDirectoryfromPath(getCurrentTemplatePath())>
<cfset thisfile=thispath & thisfile>

This works, and outputting “thistfile” gives me the correct path location. So now I call the actual method:

<cfset result=cadx.OpenDesign(thisfile,0)>

That’s where I get stuck. I get this error:

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.

I javacast the arguments and get the same error. Method not found. But based on the dump, the method is clearly there.

Has anyone encountered this or something similar?







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360288

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 9:09:20 AM3/25/15
to ColdFusion Technical Talk

Its not necessarily saying the method doesn't exist, it is saying it
doesn't exist with the arguments and/or argument TYPEs you are giving it.
Look at the types in the dump of the method you mentioned and try to
javacast() your values to match those types when passing them in.

example: opendesign(javacast('string',thisfile), javacast('int',0))

...assuming that it is actually expecting a simple string and int.

If that doesn't work, try posting the method dump or (if you have it) a
working.NET example of how it is used.



On 3/25/15, 8:28 AM, "Charles Sheehan-Miles" <cha...@sheehanmiles.net>
wrote:
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360289

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 9:18:02 AM3/25/15
to ColdFusion Technical Talk

I know I've done things like pass a file path (string) instead of file
object, so make sure the type the method wants is string or otherwise.

So might look if the function is this:

OpenDesign(File, Int)

as opposed to:

OpenDesign(String, Int)

~Byron


On Wed, Mar 25, 2015 at 9:08 AM, Bobby <bo...@acoderslife.com> wrote:

>
> example: opendesign(javacast('string',thisfile), javacast('int',0))
>
>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360290

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 9:23:58 AM3/25/15
to ColdFusion Technical Talk

I gave the benefit of the doubt but that is also my primary suspicion
(file object vs path).
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360291

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 9:45:30 AM3/25/15
to ColdFusion Technical Talk

That was my first thought too. But the documentation is pretty clear that it’s looking for the file path, and the dump shows this:

OpenDesign(java.lang.String, short)
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360292

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 10:16:06 AM3/25/15
to ColdFusion Technical Talk

Javacast the 0 as short and the path as a string and see how that goes.

example: opendesign(javacast('string',thisfile), javacast('short',0))



On 3/25/15, 9:45 AM, "Charles Sheehan-Miles" <cha...@sheehanmiles.net>
wrote:

>
>That was my first thought too. But the documentation is pretty clear
>that it?s looking for the file path, and the dump shows this:
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360293

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 10:34:00 AM3/25/15
to ColdFusion Technical Talk

Still no dice. I’m banging my head against the wall on this one. I know I’ve got the right path… I opened it up with cffile and dump it to the screen and it’s there. I don’t have an asp application using it, going to try that next. If I can get it to work there, at least it will give me some indication of where the issue might be.


> On Mar 25, 2015, at 10:15 AM, Bobby <bo...@acoderslife.com> wrote:
>
> opendesign(javacast('string',thisfile), javacast('short',0)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360294

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 11:06:22 AM3/25/15
to ColdFusion Technical Talk

Anyone have any ideas if the introspection into .NET objects shows private
methods? May be the case that the method is private being shown in the
CFDump? I seem to remember this might be the case.

May be able to use this to decompile the dll and see what is what.

http://www.red-gate.com/products/dotnet-development/reflector/
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360295

hofar...@houseoffusion.com

unread,
Mar 25, 2015, 11:10:41 AM3/25/15
to ColdFusion Technical Talk

I’ll take a look at that. This “inherited an application with no documentation” is exactly my situation. This DLL is a black box. Thank you!



> On Mar 25, 2015, at 11:06 AM, Byron Mann <byron...@gmail.com> wrote:
>
>
> Anyone have any ideas if the introspection into .NET objects shows private
> methods? May be the case that the method is private being shown in the
> CFDump? I seem to remember this might be the case.
>
> May be able to use this to decompile the dll and see what is what.
>
> http://www.red-gate.com/products/dotnet-development/reflector/
>
>
>
>
> On Wed, Mar 25, 2015 at 10:33 AM, Charles Sheehan-Miles <
> cha...@sheehanmiles.net> wrote:
>
>>
>> Still no dice. I’m banging my head against the wall on this one. I know
>> I’ve got the right path… I opened it up with cffile and dump it to the
>> screen and it’s there. I don’t have an asp application using it, going to
>> try that next. If I can get it to work there, at least it will give me some
>> indication of where the issue might be.
>>
>>
>>> On Mar 25, 2015, at 10:15 AM, Bobby <bo...@acoderslife.com> wrote:
>>>
>>> opendesign(javacast('string',thisfile), javacast('short',0)
>>
>>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360296
Reply all
Reply to author
Forward
0 new messages