ColdFusion 10 - REST Web服务错误 - 对象不是声明类的实例

时间:2014-02-28 20:09:57

标签: rest coldfusion coldfusion-10

首先,我不认为这是一个重复的问题,因为人们在执行不同的操作时收到了此错误。

问题概述:

  • 网络服务
  • 经过x段时间后,它会失败并产生下面的错误。
  • 为了让我们不得不刷新,不会发生任何代码更改。
  • 直到我们再刷新它再次开始工作的服务。
  • 没有图案,通常会在刷新后的一小时内失败。

我有一个REST Web服务,它从外部目录引用CFC并使用CF映射。 Web服务首次通过CF管理员输入时起作用。我的团队中也没有其他任何人可以找出模式,但是在刷新Web服务几个小时后,它就会失败并生成此错误:

"Error","ajp-bio-8014-exec-1478","01/01/14","12:00:00","ApplicationName","object is not an instance of declaring class The specific sequence of files included or processed is: \myWeb\Site\REST\Service\Folder\myService.cfc'' "
java.lang.IllegalArgumentException: object is not an instance of declaring class
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
                at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ObjectOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:258)
                at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
                at coldfusion.rest.method.dispatch.CFExceptionHandlingDispatcher.dispatch(CFExceptionHandlingDispatcher.java:63)
                at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:288)
                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
                at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
                at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
                at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
                at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1469)
                at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
                at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
                at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
                at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
                at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
                at coldfusion.rest.servlet.CFRestServletContainer.service(CFRestServletContainer.java:143)
                at coldfusion.rest.servlet.CFRestServletContainer.service(CFRestServletContainer.java:88)
                at coldfusion.rest.servlet.CFRestServlet.invoke(CFRestServlet.java:384)
                at coldfusion.rest.servlet.RestFilter.invoke(RestFilter.java:58)
                at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:94)
                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.rest.servlet.RestWrapRequestFilter.invoke(RestWrapRequestFilter.java:48)
                at coldfusion.rest.servlet.CFRestServlet.invoke(CFRestServlet.java:356)
                at coldfusion.rest.servlet.CFRestServlet.service(CFRestServlet.java:347)
                at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
                at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42)
                at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at com.seefusion.Filter.doFilter(Filter.java:49)
                at com.seefusion.SeeFusion.doFilter(SeeFusion.java:1500)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                at com.intergral.fusionreactor.j2ee.filterchain.WrappedFilterChain.doFilter(WrappedFilterChain.java:97)
                at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doNext(FusionReactorRequestHandler.java:437)
                at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doHttpServletRequest(FusionReactorRequestHandler.java:311)
                at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.doFusionRequest(FusionReactorRequestHandler.java:192)
                at com.intergral.fusionreactor.j2ee.filter.FusionReactorRequestHandler.handle(FusionReactorRequestHandler.java:472)
                at com.intergral.fusionreactor.j2ee.filter.FusionReactorCoreFilter.doFilter(FusionReactorCoreFilter.java:36)
                at sun.reflect.GeneratedMethodAccessor80.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                at com.intergral.fusionreactor.j2ee.filterchain.WrappedFilterChain.doFilter(WrappedFilterChain.java:79)
                at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
                at java.lang.reflect.Method.invoke(Method.java:601)
                at com.intergral.fusionreactor.agent.filter.FusionReactorStaticFilter.doFilter(FusionReactorStaticFilter.java:53)
                at com.intergral.fusionreactor.agent.pointcuts.NewFilterChainPointCut$1.invoke(NewFilterChainPointCut.java:41)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:414)
                at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:204)
                at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
                at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                at java.lang.Thread.run(Thread.java:722)

就像我说的那样,我们刷新服务并且它可以工作,但只有时间告诉它再次失败并且没有模式且代码没有任何改变。让我给你一个更简单的服务版本:

<cfcomponent rest="true" restPath="/" extends="utils.utils">
    <cffunction name="generatePDF" produces="application/json" access="remote" returnType="any" httpMethod="POST" restPath="service-pdf">
        <cfargument name="id" required="true" type="string" restargsource="form" />
        <cfset var result = "" />
        <cfset var remote_address = cgi.remote_addr />

        <cfset s3Obj = new utils.s3(accessKeyId="mySecretID", secretAccessKey="mySecretKey") />
        <cfset path = "the\path\to\store\the\pdf\" />
        <cfset objExpSub = new expenses.FormFill() />
        <cfset expenseSubmission = objExpSub.geSubmission(arguments.id) />
        <cftry>
            <cfset result = objExpSub.generatePDF(expenseSubmission, path) />
            <cfcatch type="any">
                <cfset result = {message="#cfcatch.message#", detail="#cfcatch.detail#", stacktrace="#cfcatch.stacktrace#"}>
                <cfreturn serializeJSON(result) />
                <cfabort> 
            </cfcatch>
        </cftry>

        <cfif result>
            <cfset result = {result = true} />
        </cfif>

        <cfreturn serializeJSON(result) />
    </cffunction>
</cfcomponent>

然后有一个.NET Web服务,然后调用我们的Web服务。 REST Web服务位于其自己的目录中,目前不使用Application.cfc。看不出这会导致任何问题。

我们所想的是问题,从我看到的一切,都与服务文件夹和服务中实例化的相关类被自定义CF映射引用的事实有关。因此它们不存在于CF根目录中,并且它们都不存在于同一文件夹中。

编辑(03/03/2014):我忘记提到的是<cfset objExpSub = new expenses.FormFill() />是通过CF映射实例化对象,但该映射是我们的ColdBox应用程序组件。我不是ColdBox的专家,但可能有问题吗?

更新(03/03/2014):我们将从ColdBox应用程序目录中删除组件,看看我们得到了什么样的结果。我猜我们仍然会看到错误,但只是试图消除另一种可能性。将根据我们的调查结果进

这就是我必须要做的所有事情,所以如果您需要更多信息,请具体说明因为我没有提供更多信息。

重复自己,网络服务工作!它只是随机地打破并抛出一个错误,这对我们任何人都没有任何理由。

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我有这个问题的简化版本。我有一个CFC,它是一个独立的CFC(没有包括,没有CF Mapping)设置为CF 10 REST服务。它会工作一段时间然后失败,在1小时到8小时之间。

但是我的源代码存储在网络安装上而不是本地驱动器上。当CFC移动到本地驱动器时,它变得可靠。