aeromatt
asked on
ColdFusion MX - Method not found in remote DCOM object
Hi all,
I'm trying to implement a multi-tier system [web server, app server, ...] but can't seem to connect the web server to the app server. Coldfusion keeps saying "The selected method TestFunc was not found.
There are no methods with the specified method name and argument types. Please check your function and try again." when I try to load the page.
I'm trying to call a function (from ColdFusion) in my activex EXE after creating the object remotely. Here is a snippet of the activex EXE:
-------- VB CODE ---------
Public Function TestFunc() as String
TestFunc = "hello world"
End Function
-------- END VB CODE ---------
Here is a snippet of the CF code:
-------- ColdFusion CODE ---------
<cfobject type="COM" name="stdata" action="create" class="TestProject.TestCla ss" context="remote" server="\\appserver">
<cfdump var="#stdata#">
<cfset myString = stdata.TestFunc()> <!--- This line fails --->
-------- END ColdFusion CODE ---------
Now, if I create the object in the default context (local), it works fine. It's only when I try to create the object using DCOM on the "appserver" that this fails. Am I missing some DCOM settings somewhere?
PS. The "cfdump" shows all the methods that I would expect, even when creating the object remotely.
Thanks!
I'm trying to implement a multi-tier system [web server, app server, ...] but can't seem to connect the web server to the app server. Coldfusion keeps saying "The selected method TestFunc was not found.
There are no methods with the specified method name and argument types. Please check your function and try again." when I try to load the page.
I'm trying to call a function (from ColdFusion) in my activex EXE after creating the object remotely. Here is a snippet of the activex EXE:
-------- VB CODE ---------
Public Function TestFunc() as String
TestFunc = "hello world"
End Function
-------- END VB CODE ---------
Here is a snippet of the CF code:
-------- ColdFusion CODE ---------
<cfobject type="COM" name="stdata" action="create" class="TestProject.TestCla
<cfdump var="#stdata#">
<cfset myString = stdata.TestFunc()> <!--- This line fails --->
-------- END ColdFusion CODE ---------
Now, if I create the object in the default context (local), it works fine. It's only when I try to create the object using DCOM on the "appserver" that this fails. Am I missing some DCOM settings somewhere?
PS. The "cfdump" shows all the methods that I would expect, even when creating the object remotely.
Thanks!
ASKER
hart:
>> so wasn't dll registered on the server??
The EXE was registered on the server and the client (testprogram.exe /regserver)
Also, I neglected to mention that I wrote a VB test app that creates the object and calls the function.
However, I seem to be past the first hurdle. I changed the project settings for the EXE to use Binary Compatibility (vs. NO compatibility) and now my function is getting called.
Now the problem is just an error in my function: I'm trying to open a recordset, fill up an array with the data from the resulting table, and return the array as a function return. (TestFunc() as Variant) The error number is "3709" and the description is "The connection cannot be used to perform this operation. It is either closed or invalid in this context." Still researching this, will return when I have more data.
>> so wasn't dll registered on the server??
The EXE was registered on the server and the client (testprogram.exe /regserver)
Also, I neglected to mention that I wrote a VB test app that creates the object and calls the function.
However, I seem to be past the first hurdle. I changed the project settings for the EXE to use Binary Compatibility (vs. NO compatibility) and now my function is getting called.
Now the problem is just an error in my function: I'm trying to open a recordset, fill up an array with the data from the resulting table, and return the array as a function return. (TestFunc() as Variant) The error number is "3709" and the description is "The connection cannot be used to perform this operation. It is either closed or invalid in this context." Still researching this, will return when I have more data.
ASKER
All,
My problem turned out to be a combination of ambitious coding and an incorrect oracle setting. First, I was using the ADODB.Connection as a return value from a function which had an error handler as such:
--------------- Begin VB Code ---------------------
Private Sub GetConnection() as ADODB.Connection
On Error GoTo Error_Handler:
...
Error_Handler:
...
End Sub
Public Function TestFunc(...) as ADODB.Recordset
...
myRecordset.Open GetConnection, ...
...
Set TestFunc = myRecordset
End Function
--------------- End VB Code ----------------------
Well, the GetConnection function was causing an error, and the ADODB.Connection was coming back closed. The problem was that when using DCOM on another machine, I had to change the security attributes in my sqlnet.ora file, because sometimes the connection would not open correctly. Also, this was only happening in Release mode, and not Debug. In a nutshell, almost everything is working great now. The exception is the recordset:
I'm trying to pass a disconnected recordset to coldfusion and use it as a query. When I do a CFDUMP on the return value from the TestFunc, it shows all the functionality and structure of a recordset, but for some reason, ColdFusion will not treat it as a recordset. Can anyone provide a clue?
My problem turned out to be a combination of ambitious coding and an incorrect oracle setting. First, I was using the ADODB.Connection as a return value from a function which had an error handler as such:
--------------- Begin VB Code ---------------------
Private Sub GetConnection() as ADODB.Connection
On Error GoTo Error_Handler:
...
Error_Handler:
...
End Sub
Public Function TestFunc(...) as ADODB.Recordset
...
myRecordset.Open GetConnection, ...
...
Set TestFunc = myRecordset
End Function
--------------- End VB Code ----------------------
Well, the GetConnection function was causing an error, and the ADODB.Connection was coming back closed. The problem was that when using DCOM on another machine, I had to change the security attributes in my sqlnet.ora file, because sometimes the connection would not open correctly. Also, this was only happening in Release mode, and not Debug. In a nutshell, almost everything is working great now. The exception is the recordset:
I'm trying to pass a disconnected recordset to coldfusion and use it as a query. When I do a CFDUMP on the return value from the TestFunc, it shows all the functionality and structure of a recordset, but for some reason, ColdFusion will not treat it as a recordset. Can anyone provide a clue?
aeromatt,
Because it's record set not a query.
It's probably just a structure. Not sure if you can convert a structure to a query.
I'll ask the obvious question though, WHY?
Regards
Plucka
Because it's record set not a query.
It's probably just a structure. Not sure if you can convert a structure to a query.
I'll ask the obvious question though, WHY?
Regards
Plucka
ASKER
Plucka,
To satisfy your curiosity, the reason I wanted to use it as a query was that we have a lot of existing coldfusion code that loops on queries, and now that everything is getting migrated to DCOM I'm going to have to switch all the query loops to array loops.
Derrick
aeromatt, LLC
To satisfy your curiosity, the reason I wanted to use it as a query was that we have a lot of existing coldfusion code that loops on queries, and now that everything is getting migrated to DCOM I'm going to have to switch all the query loops to array loops.
Derrick
aeromatt, LLC
Just my 2c worth but DCOM is old technology, I personally think that migrating to it now is a mistake.
ASKER
You may be right. Perhaps someday we will be migrating to .NET. For now though, we are stuck/sticking with DCOM. But, I digress. I think this question thread is no longer useful to anyone, but thank you all for your participation. Admin: Please close.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
so wasn't dll registered on the server??
Though you are specifying a class, i just wanted to know ether its an activex component or a dll that has been registered..
Also go to the registry of the remote server and check the progid of the class u r using..
Regards
Hart