Grails 2.3.8 Stacktrace不显示我的任何调用代码

时间:2014-10-27 13:43:11

标签: grails

我的控制器中有一个从某个地方调用的方法。据我所知,我的代码中没有任何东西在调用它,所以我添加了一个堆栈跟踪输出行,看看我是否可以告诉它从哪里调用。有了这个,这就是方法的样子:

def remediationSearch() {
        println " "; println ">>>>>> remediationSearch() start at " + System.nanoTime()
        new Exception("why are you calling me?!?!").printStackTrace()
        def resultList
        if (params.rerender) {
            println "<><><> remediationsearch() called with rerender."
            resultList = recordSearchService.individualSearch(session.oldIndRemedParams)
        }
        else {
            params.selectedBatch = selectedBatch
            session.oldIndRemedParams = params
            resultList = recordSearchService.individualSearch(params)
            println "<><><> remediationsearch() called fresh."
        }
        render(template: 'indivSearchResults', model: [resultList: resultList, resultCount: resultList?.size()])
        println "<<<<<< remediationSearch() end at " + System.nanoTime(); println " ";
    }

这是堆栈跟踪的输出,我似乎无法理解(部分是因为我是Grails的新手),因为我似乎没有看到任何编码函数:

    >>>>>> remediationSearch() start at 67861365037047
Error |
java.lang.Exception: why are you calling me?!?!
Error |
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Error |
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessor
Impl.java:57)
Error |
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructor
AccessorImpl.java:45)
Error |
        at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
Error |
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(Refl
ectiveInterceptor.java:986)
Error |
        at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:
77)
Error |
        at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoC
oerce.callConstructor(ConstructorSite.java:102)
Error |
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallS
iteArray.java:57)
Error |
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractC
allSite.java:182)
Error |
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractC
allSite.java:190)
Error |
        at com.twc.fatcaone.CustomerController.remediationSearch(CustomerController.groovy
:264)
Error |
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error |
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Error |
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja
va:43)
Error |
        at java.lang.reflect.Method.invoke(Method.java:606)
Error |
        at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInte
rceptor.java:1254)
Error |
        at org.codehaus.groovy.grails.web.servlet.mvc.MixedGrailsControllerHelper.invoke(M
ixedGrailsControllerHelper.java:154)
Error |
        at org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper.handl
eAction(AbstractGrailsControllerHelper.java:354)
Error |
        at org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper.execu
teAction(AbstractGrailsControllerHelper.java:231)
Error |
        at org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper.handl
eURI(AbstractGrailsControllerHelper.java:197)
Error |
        at org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper.handl
eURI(AbstractGrailsControllerHelper.java:121)
Error |
        at org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController.handleRequest
(SimpleGrailsController.java:72)
Error |
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(Simpl
eControllerHandlerAdapter.java:48)
Error |
        at org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet.doDispatch(Grail
sDispatcherServlet.java:355)
Error |
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.j
ava:856)
Error |
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServle
t.java:953)
Error |
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:8
55)
Error |
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
Error |
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:
829)
Error |
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:303)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentC
achingFilter.java:198)
Error |
        at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
Error |
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingF
ilterProxy.java:343)
Error |
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterP
roxy.java:260)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilt
er.java:101)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilt
er.java:101)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilt
er.java:101)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.jav
a:748)
Error |
        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispat
cher.java:486)
Error |
        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.
java:411)
Error |
        at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.ja
va:338)
Error |
        at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(We
bUtils.java:332)
Error |
        at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(We
bUtils.java:297)
Error |
        at org.codehaus.groovy.grails.web.util.WebUtils.forwardRequestForUrlMappingInfo(We
bUtils.java:288)
Error |
        at org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter.doFilterInterna
l(UrlMappingsFilter.java:217)
Error |
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilt
er.java:107)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.executeFilterChainWith
WrappedResponse(GrailsPageFilter.java:233)
Error |
        at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.obtainContent(GrailsPa
geFilter.java:208)
Error |
        at org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter.doFilter(GrailsPageFil
ter.java:153)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at javax.servlet.FilterChain$doFilter.call(Unknown Source)
Error |
        at org.grails.plugin.resource.DevModeSanityFilter.doFilter(DevModeSanityFilter.gro
ovy:45)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInter
nal(GrailsWebRequestFilter.java:69)
Error |
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilt
er.java:107)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(
HiddenHttpMethodFilter.java:67)
Error |
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilt
er.java:107)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(Charact
erEncodingFilter.java:88)
Error |
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilt
er.java:107)
Error |
        at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingF
ilterProxy.java:343)
Error |
        at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterP
roxy.java:260)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil
terChain.java:241)
Error |
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain
.java:208)
Error |
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
220)
Error |
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
122)
Error |
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
Error |
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
Error |
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:11
6)
Error |
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
Error |
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processo
r.java:1040)
Error |
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractPr
otocol.java:607)
Error |
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315
)
Error |
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

Error |
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

Error |
        at java.lang.Thread.run(Thread.java:745)
<><><> remediationsearch() called fresh.
<<<<<< remediationSearch() end at 67863898745818

`

1 个答案:

答案 0 :(得分:1)

如果将此输出与“真实”请求进行比较,您将看到基本相同的事情。这是我期望看到的 - 过滤器链中的各种过滤器被调用,然后是servlet的服务方法(请注意,servlet是GrailsDispatcherServlet,它扩展了Spring的DispatcherServlet),然后它转到doPost这很奇怪,因为这是一个POST请求,但这似乎是一个GET,然后到doDispatch(Grails指出在哪里路由请求),然后到{{1 }}

Grails应用程序SimpleControllerHandlerAdapter.handle中只有一个Spring MVC控制器。它充当Grails控制器和Spring MVC之间的桥梁。 Grails控制器只是Groovy类,所以它们不能注册为Spring MVC控制器,而是这个控制器实例处理所有请求并在SimpleGrailsController的帮助下告诉它控制器和方法(基于反向)从请求的URL到MixedGrailsControllerHelper中的条目的URL映射,它使用反射来调用控制器方法。这就是为什么在你的控制器动作之前有一个URLMappings.groovy。 springloaded Method.invoke就在那里,因为springloaded在开发模式下添加了重新加载支持,但是否则可以忽略它。

您最好的选择是在调试模式下运行应用程序并设置一些断点,以便您可以找出所请求的URL。在此之前 - 设置这些类的Log4j级别进行调试,也许这会有一些有用的东西。