سؤال

I've been banging my head on this for a while, can't seem to find any decent answers or explanations for these errors. I am using a 3rd party JAR "PropHandler.jar" I am trying to call the getMessageList method, it accepts 3 args and requires a config file.

<cfset configFile = 'C:\data\getMsgListCONFIG.xml'>
<cfset Obj = createObject("java","client.PropHandler") />
<cfdump var="#Obj#">


All good here, my dump returns a list of methods. Now, I need to get my config file to the method and pass in my args, no love here, I have tried this:

<cfset x = Obj.getMessageList.init(configFile)>

And

<cfset x = Obj.getMessageList().init(configFile)>

And

<cfset x = Obj.getMessageList('identifier', 'greaterthan', '2012-05-18T12:00:00-04:00').init(configFile)>

And even tried initializing via the creation of the object:

<cfset Obj = createObject("java","client.PropHandler").getMessageList('identifier', 'greaterthan', '2012-05-18T12:00:00-04:00').init(configFile)>

All Return the same error:

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

When I don't send the 3 args I get a method not found error, if I don't send the init I get the same error.

So, I do not have a lot of experience with JAVA and I do not understand the error message. I can use the JAR fine when calling from a command line, or even when executing with a BAT file, but when I do that I can't get the XML SOAP array returned to me...

From the Java Doc:

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 Properties

Throws:

  • 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 enum
  • comp_Op1 - One of CompOp enum
  • parValue1 - a value for comparison

Returns:

metadata message list meeting query criteria Returns null if an exception is encountered instead of throwing an exception.

هل كانت مفيدة؟

المحلول

The structure of the call works as:

<cfset Obj = createObject("java","client.PropHandler") />   
<cfset Meth = Obj.init(argfile).getMessageList(arg1,arg2,arg3)>

The argfile variable is the path to an XML config file, and it also referenced another config file using a relative path. I found this error from the stack trace (below) once the path was changed to absolute inside argfile the error was resolved.

Stack Trace at cf_getMsgs2ecfm497532872.runPage(E:\Inetpub\wwwroot_getMsgs.cfm:24) at cf_getMsgs2ecfm497532872.runPage(E:\Inetpub\wwwroot_getMsgs.cfm:24)

java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at coldfusion.runtime.java.JavaProxy.CreateObject(JavaProxy.java:156) at coldfusion.runtime.java.JavaProxy.invoke(JavaProxy.java:63) at coldfusion.runtime.CfJspPage._invoke(CfJspPage.java:2272) at cf_getMsgs2ecfm497532872.runPage(E:\Inetpub\wwwroot_getMsgs.cfm:24) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:196) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:370) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:86) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at coldfusion.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:74) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:46) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.CfmServlet.service(CfmServlet.java:175) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:286) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543) at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66) Caused by: java.io.FileNotFoundException: ..\data\APIproperties.xml (The system cannot find the path specified) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.(FileInputStream.java:106) at java.io.FileInputStream.(FileInputStream.java:66) at client.PropertyHandler.(PropertyHandler.java:133)

Thanks @Leigh and @imthepitts

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top