我一直對此感興趣一段時間,似乎無法找到任何像樣的答案或對這些錯誤的解釋。我正在使用第三方JAR「PropHandler.jar」 我想調用getMessageList方法,它接受3個參數,並需要一個配置文件。ColdFusion初始化一個需要外部配置文件的Java對象方法
<cfset configFile = 'C:\data\getMsgListCONFIG.xml'>
<cfset Obj = createObject("java","client.PropHandler") />
<cfdump var="#Obj#">
這裏都好,我轉儲返回的方法列表。現在,我需要讓我的配置文件的方法,並通過在我指定參數時,這裏沒有愛情,我已經試過這樣:
<cfset x = Obj.getMessageList.init(configFile)>
而且
<cfset x = Obj.getMessageList().init(configFile)>
而且
<cfset x = Obj.getMessageList('identifier', 'greaterthan', '2012-05-18T12:00:00-04:00').init(configFile)>
甚至嘗試通過創建對象初始化:
<cfset Obj = createObject("java","client.PropHandler").getMessageList('identifier', 'greaterthan', '2012-05-18T12:00:00-04:00').init(configFile)>
都返回相同的錯誤:
Object Instantiation Exception
An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. If the class has a constructor that accepts an argument, you must call the constructor explicitly using the init(args) method. Error : client.PropertyHandler
當我不送3個ARGS我得到一個方法未找到錯誤,如果我不發送init我得到同樣的錯誤。
所以,我沒有很多JAVA的經驗,我不明白錯誤消息。從命令行調用時,或者甚至在執行BAT文件時,我都可以使用JAR,但是當我這樣做時,我無法將XML SOAP數組返回給我...
從Java文件:
PropertyHandler
public PropertyHandler(java.lang.String propFile) throws java.lang.Exception
Uses a Property File to set up all program variables. This Property File refers to a second Property File that identifies user Id and security file data.
Parameters:
propFile
- XML file of PropertiesThrows:
java.lang.Exception
getMessageList
public services.[...].GetResponseTypeDef getMessageList(java.lang.String par1, java.lang.String comp_Op1, java.lang.String parValue1)
Overrides X_Properties to returns a list of metadata about each message that meets the query defined by the function parameters.
Parameters:
par1
- One of Parameter enumcomp_Op1
- One of CompOp enumparValue1
- a value for comparisonReturns:
metadata message list meeting query criteria Returns null if an exception is encountered instead of throwing an exception.
嘗試調用的init()的Java對象,然後調用其參數的方法。 Obj.init(...)。getMessageList(...) – imthepitts
Obj.init(configfile).getMessageList('identifier','greaterthan','2012-05-18T12:00:00-04:00') 相同的錯誤:對象實例化異常。 實例化Java對象時發生異常。該類不能是接口或抽象類。錯誤:''。 – Wes
這只是一個你用java對象得到的樣板消息,你能否更新你的問題來包含* full * stack trace?(這是真正的錯誤信息所在)。另外,'#configFile#'的實際值是多少? – Leigh