Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to solve ClassCastException for java.util.ArrayList via WSDL of ColdFusion 9's CFC?
    primarykey
    data
    text
    <p>I hope this problem would not waste your time.</p> <p>I use Adobe Coldfusion 9 to create CFC to to interact with database. Generally, CFC can be generate WSDL by itself. for example:</p> <pre><code>http://localhost/services/employeeService.cfc?wsdl </code></pre> <p>The WSDL was generated well. But the problem has been found when I tried to use Adobe Flash Builder 4's Data service to generate service class to connect ColdFusion's WSDL.</p> <p>If you tried to invoked the remote function that return primitive data type as int or String, it works correctly. </p> <pre><code>remote numeric function count() { return ormExecuteQuery("select Count(*) from employee")[1]; } </code></pre> <p><img src="https://i.stack.imgur.com/MSKKi.jpg" alt="With return as primitive type, it works."></p> <p>But complex data type such as, return custom class returned with no data in the field. </p> <pre><code>remote fp_sandbox.cfc.employee function get(required numeric id ) { return EntityLoad("employee", arguments.id, true); } </code></pre> <p><img src="https://i.stack.imgur.com/D08q0.jpg" alt="Return a complex data type object, but properties is empty."></p> <p>For array, if the remote function specified as ColdFusion's Array, it will return an array but with no data in object's property:</p> <pre><code>remote Array function list() { return entityLoad("employee", {}, "idEmployee asc"); } </code></pre> <p><img src="https://i.stack.imgur.com/SKTUD.jpg" alt="If return type is default Array, the children in array has no value in property."></p> <p>and if the return type is ORM genarated code, it will throw the exception. It looks like ColdFusion try to cast something.</p> <pre><code>remote fp_sandbox.cfc.employee[] function search(string q ) { // query creating. return ormExecuteQuery(hqlString, false, params); } </code></pre> <p>StackTrace:</p> <blockquote> <p>InvocationTargetException:There was an error while invoking the operation. Check your operation inputs and try invoking the operation again.</p> </blockquote> <p>Response Received:</p> <blockquote> <p>soapenv:Server.userException coldfusion.xml.rpc.CFCInvocationException: [java.lang.ClassCastException : java.util.ArrayList] coldfusion.xml.rpc.CFCInvocationException: [java.lang.ClassCastException : java.util.ArrayList] at coldfusion.xml.rpc.CFComponentSkeleton.__createCFCInvocationException(CFComponentSkeleton.java:733) at coldfusion.xml.rpc.CFComponentSkeleton.__cast(CFComponentSkeleton.java:409) at fp_sandbox.services.EmployeeService.search(D:\home\cashr.com\wwwroot\fp_sandbox\services\employeeService.cfc) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388) at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283) at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323) at coldfusion.xml.rpc.CFCProvider.invoke(CFCProvider.java:54) at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281) at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699) at coldfusion.xml.rpc.CFCServlet.doAxisPost(CFCServlet.java:270) at coldfusion.filter.AxisFilter.invoke(AxisFilter.java:43) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:356) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:87) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:138) at coldfusion.xml.rpc.CFCServlet.doPost(CFCServlet.java:289) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) 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 com.seefusion.Filter.doFilter(Filter.java:49) at com.seefusion.SeeFusion.doFilter(SeeFusion.java:1500) 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) ntcps1</p> </blockquote> <p>Could you give me any suggestion to solve or workaround this problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload