1 Reply Latest reply on Feb 28, 2008 11:26 AM by bobmoles

    .Net Integration

      I'm having some trouble with .Net Integration. I have a .Net class that has one function that takes a 3 parameters. It works fine from .Net. However, when I try from ColdFusion, it can instantiate the object just fine (cfdump dumps the object functions with the correct data types as parameters), but when I call it, I just a very generic error. In fact, the error is so generic that it offers no error details at all. All it gives me is the line number.

      I even went so far as to remove 2 of the parameters from the .Net object so I could remove any possible complexity. But I still get the same error.

      The function basically takes the input strings and creates another .Net object based on the input, which it then inserts into the Microsoft Messaging Queue. The functionality of the classes work perfect in .Net. When I rebuild the solution after I make changes, the changes are represented in the CFDump, so it doesn't seem like it is trying to use a cached version of the .Net dll (but I'm not 100% sure of that -- is there a way of clearing any cached .net objects? I noticed the following directory: Y:\ColdFusion8\wwwroot\WEB-INF\cfclasses\dotNetProxy which seems to have some jar files with dates that match my .Net objects).

      I just can't seem to figure out what is causing the error. The fact that it doesn't tell me anything doesn't help! Here is the extent of the error message:

      The error occurred in D:\Inetpub\NIAC-ANI-Core\TEST\MSMQ.cfm: line 37

      35 :
      36 : <!--- send message using the AMS Queue Manager --->
      37 : <cfset foo = obj_AMSQM.SendMessage( "hello" )>
      38 :
      39 :

      In the past, when I've tried to pass in mis-typed or unhandled data-types into the function it gave me this error:

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

      So, I don't think it I'm trying to pass a mistyped variable into the function. But without error details, I'm not sure how to figure out what's wrong! I've attached the CF code I'm using below.

      This is the function output from the CF dump:
      Class Name: MessageQueue.AMSQueueManager

      Method Return Type
      -------------------------------------- ----------------------
      SendMessage(java.lang.String) boolean


      I've also tried to implement some error logging within the .Net object to try to capture the error as if it occurs in the .Net object, but log entries never appear. That makes me think that the error is in CF before it even gets to the .Net object.

      In addition, I've also successfully loaded the other .Net class into CF (which builds the object to be passed to the message queue passed on the params passed into the first object). The CF Dump correctly displays the available functions. Most of the SET functions work properly. But I have two different SETs that pass in STRINGS. One of them works just fine, while the other gives me the same generic, not details error. All of the GETs seem to work just fine, except the one that is associated with the SET that is failing.

      This is the CFDump info from the second object I tried:
      Class Name: MessageQueue.AMSQueueMessage

      Method Return Type
      -------------------------------------- ----------------------
      Get_MessageBody() System.Xml.XmlDocument
      Get_MessageBodyStr() java.lang.String
      Get_MessageDate() System.DateTime
      Get_MessageType() java.lang.String
      Set_MessageBody(System.Xml.XmlDocument) void
      Set_MessageBodyStr(java.lang.String) void
      Set_MessageDate(System.DateTime) void
      Set_MessageType(java.lang.String) void


      I'm able to use the Set_MessageType just fine, but the Set_MessageBodyStr fails with the generic, no details error. To me, they look exactly the same. I had one of our senior .Net guys look at my code (since I'm mainly CF with only a bit of .Net) and he says it's perfect. I've attached the CF code I'm using below.

      I guess I'm looking for any info on either what I'm doing wrong or how to track down the error...


        • 1. Re: .Net Integration
          The first thing I would do is go the the CF administrator and make sure all of your DEBUG information is being displayed. By default, some isn't. A lot of times when you get a .net error and it tells you nothing, go to the area below Execution Time and there is an exceptions area. That is usually where .NET errors are returned (system.nullReferenceException for example).
          When passing in strings, I typically assign it to a variable, then pass in the variable. It shouldn't matter, but sometimes I have run into issues with passing a string in. In your second object, look at the date object. The Coldfusion date object and the .Net date object are not the same. Hope this helps.