Coldfusion在实例化.Net引用时缺少错误信息

时间:2014-05-13 21:59:01

标签: c# .net dll coldfusion ms-office

因此,我正在使用Microsoft Office Open XML SDK,并试图在我的CF 10实例中实例化它的类。

我开始尝试创建DocumentType类,所以我使用了代码:

writeDump(createObject("dotnet","DocumentFormat.OpenXml.Wordprocessing.DocumentType","C:\Program Files (x86)\Open XML SDK\V2.5\lib\DocumentFormat.OpenXml.dll").DocumentType());abort;

但这给了我一个错误,没有有用的信息。

ColdFusion Error with no information about type of error

所以我读到你还需要在类信息中包含命名空间。然而,这也会导致错误,但有一些不错的信息:

  

在指定的程序集列表中找不到类DocumentFormat.OpenXml.Wordprocessing.DocumentFormat.OpenXml.Wordprocessing.DocumentType。

     

必须将包含该类的程序集提供给assembly属性。

我现在对此感到有点难过。我做错了吗。

作为第二点,有没有办法转储DLL包含的所有可以引用的类?

修改

将代码更改为@Leigh在评论中建议,请阅读:

writeDump(createObject("dotnet","DocumentFormat.OpenXml.Wordprocessing.DocumentType","C:\Program Files (x86)\Open XML SDK\V2.5\lib\DocumentFormat.OpenXml.dll"));abort;

C:\ColdFusion10\cfusion\jnbridge\error.log

中产生此错误
======================
13/05/2014 23:23:53
Java-side exception: com.jnbridge.jnbcore.ClassNotFoundException
Java-side exception message: java.lang.Class+EnclosingMethodInfo
Java-side stack trace: com.jnbridge.jnbcore.ClassNotFoundException:
java.lang.Class+EnclosingMethodInfo
at com.jnbridge.jnbproxy.ClassInfo.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.jnbridge.jnbcore.JNBDispatcher.construct(Unknown Source)
at com.jnbridge.jnbcore.JNBDispatcher.call(Unknown Source)
at com.jnbridge.jnbcore.server.b.d.a(Unknown Source)
at com.jnbridge.jnbcore.server.b.c.p(Unknown Source)
at com.jnbridge.jnbcore.server.b.c.run(Unknown Source)
at java.lang.Thread.run(Thread.java:722)

.NET-side stack trace = .NET-side stack trace:

at com.jnbridge.jnbproxy.ExceptionFactory.throwException(JNBException e, Hashtable objMap)
at com.jnbridge.jnbproxy.ClassInfo..ctor(String name)
at com.jnbridge.jnbcore.ObjectHelper.getSubstituteProxy(String returnedType, Type expectedType)
at com.jnbridge.jnbproxy.ProxyClass.getSubstituteProxy(String className)
at com.jnbridge.jnbproxy.ProxyClass.getType(String className, Boolean noSubstituteProxy)
at com.jnbridge.jnbproxy.ProxyClass.isThreadTrue(String className, Hashtable threadTrue, ClassInfo ci)
at com.jnbridge.jnbproxy.ProxyClass.generateProxyClassMembers(ModuleBuilder module, ClassInfo ci, Boolean verbose, Boolean noSupporting, Boolean isJSharpCompatible, ReferenceValueData refValData, Hashtable threadTrue, Boolean mapEnums)
at com.jnbridge.jnbproxy.ProxyAssembly.addClass(ClassInfo ci)
at com.jnbridge.jnbcore.ObjectHelper.getSubstituteProxy(String returnedType, Type expectedType)
at com.jnbridge.jnbproxy.ProxyClass.getSubstituteProxy(String className)
at com.jnbridge.jnbproxy.ProxyClass.getType(String className, Boolean noSubstituteProxy)
at com.jnbridge.jnbproxy.ProxyField.genClassLiteral(TypeBuilder theClass, ReferenceValueOptions rvo)
at com.jnbridge.jnbproxy.ProxyClass.generateProxyClassMembers(ModuleBuilder module, ClassInfo ci, Boolean verbose, Boolean noSupporting, Boolean isJSharpCompatible, ReferenceValueData refValData, Hashtable threadTrue, Boolean mapEnums)
at com.jnbridge.jnbproxy.ProxyAssembly.addClass(ClassInfo ci)
at com.jnbridge.jnbcore.ObjectHelper.getSubstituteProxy(String returnedType, Type expectedType)
at com.jnbridge.jnbproxy.ProxyClass.getSubstituteProxy(String className)
at com.jnbridge.jnbproxy.ProxyClass.getType(String className, Boolean noSubstituteProxy)
at com.jnbridge.jnbproxy.ProxyClass.isThreadTrue(String className, Hashtable threadTrue, ClassInfo ci)
at com.jnbridge.jnbproxy.ProxyClass.generateProxyClassMembers(ModuleBuilder module, ClassInfo ci, Boolean verbose, Boolean noSupporting, Boolean isJSharpCompatible, ReferenceValueData refValData, Hashtable threadTrue, Boolean mapEnums)
at com.jnbridge.jnbproxy.ProxyAssembly.addClass(ClassInfo ci)
at com.jnbridge.jnbcore.ObjectHelper.getSubstituteProxy(String returnedType, Type expectedType)
at com.jnbridge.jnbproxy.ExceptionFactory.throwException(JNBException e, Hashtable objMap)
at com.jnbridge.jnbcore.ProxyJarFile.close()
at com.jnbridge.jnbproxy.JNBProxy.generateJavaProxies(String[] classes, Options options, AppDomain dotNetAssembliesAppDomain, Hashtable refValueMap, Hashtable threadTrue)
at com.jnbridge.jnbproxy.JNBProxy.Main(String[] args)

Java-side stack trace:

com.jnbridge.jnbcore.ClassNotFoundException: java.lang.Class+EnclosingMethodInfo
at com.jnbridge.jnbproxy.ClassInfo.<init>(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.jnbridge.jnbcore.JNBDispatcher.construct(Unknown Source)
at com.jnbridge.jnbcore.JNBDispatcher.call(Unknown Source)
at com.jnbridge.jnbcore.server.b.d.a(Unknown Source)
at com.jnbridge.jnbcore.server.b.c.p(Unknown Source)
at com.jnbridge.jnbcore.server.b.c.run(Unknown Source)
at java.lang.Thread.run(Thread.java:722)`

1 个答案:

答案 0 :(得分:0)

之前我遇到过这个问题。会发生什么是.Net代码返回一个类,该类没有代理或抛出SomeClass.CustomException类型的异常,其中jnbridge / CF .Net没有代理。在两种情况下都返回&#34; ClassNotFound&#34;。

我所做的是提前将这些类添加到程序集列表中并实例化然后将它们转储(这样就构建了类代理)。

<!--- Instantiate our exception classes to ensure the proxies exists --->
<cfset nullObj=CreateObject(".net","System.Net.WebExceptionStatus","C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll")>
<cfset nullObj=CreateObject(".net","System.Net.WebResponse","C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll")>
<cfset nullObj=CreateObject(".net","System.Net.HttpStatusCode","C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll")>

<!--- Create our Web Request class --->
<cfset webReq=CreateObject(".net","OURCUSTOMWRAPPER.HTTP.HTTPXMLWebRequest","C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll,C:\resources\utilities\OURCUSTOMWRAPPERLibray.dll")>