0

我有一个 ColdFusion 9 实例和一个 .NET DLL。.NET DLL 是非常简单的字符串解析,可以让我在 CF 中更轻松地完成一些任务。每个想要使用字符串执行某些特定于客户端的任务的客户端都有一个 DLL,但是从原始源中提取这些项目的核心不会因客户端而异。

在这种情况下,我有一个看起来像这样的对象:

public class clsNotification : BaseClass
{
    public string GetSimpleString()
    {
        return "I was here";
    }


    public string GetNotificationsXml(int ProjectID)
    {
       return MybaseClass.getXML(ProjectID);
    }
}

通知类是主 DLL,而 BaseClass 在单独的 DLL 中。

更新: 出于测试目的,我将所有内容都放在一个 DLL 中,但它仍然给我同样的错误。我收到的错误是:

coldfusion.xml.rpc.CFCInvocationException: [java.lang.NoClassDefFoundError :
System/Xml/XmlQualifiedName][java.lang.ClassNotFoundException :
System.Xml.XmlQualifiedName]

不幸的是,我无权访问日志文件夹。我猜他们认为这是一个安全风险或什么的。我已将 System.Xml.dll 放入文件夹中,但 .NET 集成服务似乎仍未拾取它。

有什么新想法吗?为什么找不到 XmlQualifiedName?

更新 2: ColdFusion 代码非常简单。它是一个具有如下所述功能的 cfcomponent:

<cffunction name="GetNotificationsXml" access="remote" returntype="string" output="false">
    <cfargument name="ProjectID" type="numeric" required="yes">

    <cfobject name="myObj" type=".NET" 
        assembly="#ExpandPath("./")#Published .NET DLLs/Notifications.dll" 
        class="#Namespace#.clsNotifications">

    <cfset str=myObj.GetNotificationsXml(ProjectID) />

    <cfreturn str>
</cffunction>
4

1 回答 1

0

I kept having this issue where a class would instantiate but an exception would result in this error. What I figured out, through tinkering, is that even with the assembly list containing the proper dll it still fails since I presume the JNB Proxy doesn't include that class in the proxy generation.

What I do is instantiate the class directly like this:

<cfset nullObj=CreateObject(".net","System.Net.WebExceptionStatus"
          ,"C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll")> 

So that when/if the exception occurs there is a generated proxy for the class and the error will not occur.

于 2013-03-05T18:49:11.060 回答