如何解决 ColdFusion 9 中的 Java 空指针错误?
我正在使用 ColdFusion 9.1.0。
我正在开发一个网站的一部分,该网站是其他人不久前开发的。有人走了而且没有任何文件。我可以访问 CF 管理员,但找不到任何可以帮助我解决特定问题的内容。
在下面的代码中,创建了一个 Java 对象(auth),然后在下一行中引用该对象。两个变量被传递到方法 (runTransaction)、属性文件 (VARIABLES.PropsFile) 和 XML (VARIABLES.MyXML)。
<cfobject action="create" type="Java" class="CyberSource" name="auth">
<cfset VARIABLES.ResponseString = auth.runTransaction(VARIABLES.PropsFile,VARIABLES.MyXML)>
对象已成功创建。我知道这一点是因为当我更改对象的类时,它会爆炸!当我将其改回“CyberSource”时,它就起作用了。
我知道属性文件存在。我知道 XML 存在。
我得到的错误是这样的:
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values.
The error occurred in D:/inetpub/wwwroot/Watkins_OE-DEV/Test.cfm: line 63
61 : <!--- CREATE JAVA OBJECT --->
62 : <cfobject action="create" type="Java" class="CyberSource" name="auth">
63 : <cfset VARIABLES.ResponseString = auth.runTransaction(VARIABLES.PropsFile,VARIABLES.MyXML)>
您能否向我提供有关此错误的真正含义以及我下一步可能要查看的位置的任何线索?
编辑:
我无法确定我的问题是什么,但我开始以不同的方式解决它。我找到了一个可以正常工作的文件,然后慢慢地重建它,一路上对其进行了 100 次测试。
非常感谢您的提示和提示!
I am using ColdFusion 9.1.0.
I am working on part of a site that someone else developed a while back. That someone is gone and there is no documentation. I can access the CF Administrator, but I can't find anything that helps me with a specific problem.
In the code below, a Java object is created (auth) and then in the next line, the object is referenced. Two variables are passed to the method (runTransaction), the properties file (VARIABLES.PropsFile) and the XML (VARIABLES.MyXML).
<cfobject action="create" type="Java" class="CyberSource" name="auth">
<cfset VARIABLES.ResponseString = auth.runTransaction(VARIABLES.PropsFile,VARIABLES.MyXML)>
The object is successfully created. I know this because when I change the class of the object, it blows up! When I change it back to "CyberSource", it works.
I know that the properties file exists. I know that the XML exists.
The error I get is this:
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values.
The error occurred in D:/inetpub/wwwroot/Watkins_OE-DEV/Test.cfm: line 63
61 : <!--- CREATE JAVA OBJECT --->
62 : <cfobject action="create" type="Java" class="CyberSource" name="auth">
63 : <cfset VARIABLES.ResponseString = auth.runTransaction(VARIABLES.PropsFile,VARIABLES.MyXML)>
Can you provide me with any clues as to what this error really means and where I might look next?
EDIT:
I can't pinpoint what my problem WAS, but I went about solving it a different way. I found a file that WAS working and slowly rebuilt it, testing it 100 times along the way.
Many thanks for the tips and hints!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档,用 try/catch 包装 auth.runTransaction() 。
以下代码片段来自 CyberSource java api 附带的示例:
所有平台 Java zip 中都有一些 Coldfusion 示例,可在此处下载:
http://apps.cybersource.com/cgi-bin/pages/dev_kits.cgi?kit=Java/All_Platforms
As per the documentation, wrap your auth.runTransaction() with a try/catch.
The following snippet comes from the samples included with the CyberSource java api:
There are some coldfusion samples inside the All Platforms Java zip downloadable here:
http://apps.cybersource.com/cgi-bin/pages/dev_kits.cgi?kit=Java/All_Platforms