ERROR errors.GrailsExceptionResolver - 处理请求时发生NullPointerException:[GET]

时间:2015-07-29 14:30:25

标签: javascript jquery ajax grails gsp

当我尝试进行ajax调用时,我遇到了错误。

我正在传递服务调用所需的参数。

我正在收到的错误:

Error |
2015-07-29 19:47:33,493 [http-bio-8080-exec-14] ERROR errors.GrailsExceptionResolver  - NullPointerException occurred when processing request: [GET] /forms/landing/deleteSelectedFile - parameters:
attachmentId: 164
Stacktrace follows:
Message: null
    Line | Method
->>   48 | execute                         in org.activiti.engine.impl.cmd.DeleteAttachmentCmd
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     24 | execute                         in org.activiti.engine.impl.interceptor.CommandInvoker
|     57 | execute . . . . . . . . . . . . in org.activiti.engine.impl.interceptor.CommandContextInterceptor
|     31 | execute                         in org.activiti.engine.impl.interceptor.LogInterceptor
|     40 | execute . . . . . . . . . . . . in org.activiti.engine.impl.cfg.CommandExecutorImpl
|     35 | execute                         in     ''
|    357 | deleteAttachment . . . . . . .  in org.activiti.engine.impl.TaskServiceImpl
|     -1 | invoke                          in sun.reflect.GeneratedMethodAccessor845
|     43 | invoke . . . . . . . . . . . .  in sun.reflect.DelegatingMethodAccessorImpl
|    606 | invoke                          in java.lang.reflect.Method
|   1270 | jlrMethodInvoke . . . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
|    189 | invoke                          in org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSite
|     53 | call . . . . . . . . . . . . .  in org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite
|    112 | call                            in org.codehaus.groovy.runtime.callsite.AbstractCallSite
|    701 | deleteAttachemnt . . . . . . .  in grails.power.form.ActivitiService
|     -1 | invoke                          in grails.power.form.ActivitiService$$FastClassBySpringCGLIB$$d4cb6609
|    204 | invoke . . . . . . . . . . . .  in org.springframework.cglib.proxy.MethodProxy
|    708 | invokeJoinpoint                 in org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation
|    157 | proceed . . . . . . . . . . . . in org.springframework.aop.framework.ReflectiveMethodInvocation
|     98 | proceedWithInvocation           in org.springframework.transaction.interceptor.TransactionInterceptor$1
|    262 | invokeWithinTransaction . . . . in org.springframework.transaction.interceptor.TransactionAspectSupport
|     95 | invoke                          in org.springframework.transaction.interceptor.TransactionInterceptor
|    179 | proceed . . . . . . . . . . . . in org.springframework.aop.framework.ReflectiveMethodInvocation
|    644 | intercept                       in org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor
|     -1 | deleteAttachemnt . . . . . . .  in grails.power.form.ActivitiService$$EnhancerBySpringCGLIB$$3305bc1c
|    440 | deleteSelectedFile              in grails.power.form.LandingController
|     -1 | invoke . . . . . . . . . . . .  in sun.reflect.GeneratedMethodAccessor784
|     43 | invoke                          in sun.reflect.DelegatingMethodAccessorImpl
|    606 | invoke . . . . . . . . . . . .  in java.lang.reflect.Method
|   1270 | jlrMethodInvoke                 in org.springsource.loaded.ri.ReflectiveInterceptor
|    154 | invoke . . . . . . . . . . . .  in org.codehaus.groovy.grails.web.servlet.mvc.MixedGrailsControllerHelper
|    375 | handleAction                    in org.codehaus.groovy.grails.web.servlet.mvc.AbstractGrailsControllerHelper
|    252 | executeAction . . . . . . . . . in     ''
|    205 | handleURI                       in     ''
|    126 | handleURI . . . . . . . . . . . in     ''
|     72 | handleRequest                   in org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController
|     50 | handle . . . . . . . . . . . .  in org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter
|    347 | doDispatch                      in org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet
|    870 | doService . . . . . . . . . . . in org.springframework.web.servlet.DispatcherServlet
|    961 | processRequest                  in org.springframework.web.servlet.FrameworkServlet
|    852 | doGet . . . . . . . . . . . . . in     ''
|    620 | service                         in javax.servlet.http.HttpServlet
|    837 | service . . . . . . . . . . . . in org.springframework.web.servlet.FrameworkServlet
|    727 | service                         in javax.servlet.http.HttpServlet
|    303 | internalDoFilter . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                        in     ''
|     52 | doFilter . . . . . . . . . . .  in org.apache.tomcat.websocket.server.WsFilter
|    241 | internalDoFilter                in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . .  in     ''
|    198 | doFilter                        in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter . . . . . . . . . . .  in grails.plugin.cache.web.filter.AbstractFilter
|    344 | invokeDelegate                  in org.springframework.web.filter.DelegatingFilterProxy
|    261 | doFilter . . . . . . . . . . .  in     ''
|    241 | internalDoFilter                in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . .  in     ''
|    101 | doFilter                        in org.springframework.web.filter.OncePerRequestFilter
|    241 | internalDoFilter . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                        in     ''
|    101 | doFilter . . . . . . . . . . .  in org.springframework.web.filter.OncePerRequestFilter
|    241 | internalDoFilter                in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . .  in     ''
|    101 | doFilter                        in org.springframework.web.filter.OncePerRequestFilter
|    241 | internalDoFilter . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                        in     ''
|    748 | invoke . . . . . . . . . . . .  in org.apache.catalina.core.ApplicationDispatcher
|    486 | processRequest                  in     ''
|    411 | doForward . . . . . . . . . . . in     ''
|    338 | forward                         in     ''
|    178 | forwardRequestForUrlMappingInfo in org.codehaus.groovy.grails.web.mapping.UrlMappingUtils
|    144 | forwardRequestForUrlMappingInfo in     ''
|    135 | forwardRequestForUrlMappingInfo in     ''
|    216 | doFilterInternal                in org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter
|    107 | doFilter . . . . . . . . . . .  in org.springframework.web.filter.OncePerRequestFilter
|    241 | internalDoFilter                in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter . . . . . . . . . . .  in     ''
|    330 | doFilter                        in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    181 | doFilter . . . . . . . . . . .  in org.springframework.security.web.authentication.switchuser.SwitchUserFilter
|    342 | doFilter                        in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    118 | invoke . . . . . . . . . . . .  in org.springframework.security.web.access.intercept.FilterSecurityInterceptor
|     84 | doFilter                        in     ''
|    342 | doFilter . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    113 | doFilter                        in org.springframework.security.web.access.ExceptionTranslationFilter
|    342 | doFilter . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     53 | doFilter                        in grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter
|    342 | doFilter . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    146 | doFilter                        in org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter
|    342 | doFilter . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    154 | doFilter                        in org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter
|    342 | doFilter . . . . . . . . . . .  in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    199 | doFilter                        in org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter
|     49 | doFilter . . . . . . . . . . .  in grails.plugin.springsecurity.web.authentication.RequestHolderAuthenticationFilter
|    342 | doFilter                        in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     82 | doFilter . . . . . . . . . . .  in grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter
|    342 | doFilter                        in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|     87 | doFilter . . . . . . . . . . .  in org.springframework.security.web.context.SecurityContextPersistenceFilter
|    342 | doFilter                        in org.springframework.security.web.FilterChainProxy$VirtualFilterChain
|    192 | doFilterInternal . . . . . . .  in org.springframework.security.web.FilterChainProxy
|    160 | doFilter                        in     ''
|    344 | invokeDelegate . . . . . . . .  in org.springframework.web.filter.DelegatingFilterProxy
|    261 | doFilter                        in     ''
|    241 | internalDoFilter . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                        in     ''
|     69 | doFilterInternal . . . . . . .  in org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter
|    107 | doFilter                        in org.springframework.web.filter.OncePerRequestFilter
|    241 | internalDoFilter . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                        in     ''
|     67 | doFilterInternal . . . . . . .  in org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter
|    107 | doFilter                        in org.springframework.web.filter.OncePerRequestFilter
|    241 | internalDoFilter . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                        in     ''
|     88 | doFilterInternal . . . . . . .  in org.springframework.web.filter.CharacterEncodingFilter
|    107 | doFilter                        in org.springframework.web.filter.OncePerRequestFilter
|    344 | invokeDelegate . . . . . . . .  in org.springframework.web.filter.DelegatingFilterProxy
|    261 | doFilter                        in     ''
|    241 | internalDoFilter . . . . . . .  in org.apache.catalina.core.ApplicationFilterChain
|    208 | doFilter                        in     ''
|    220 | invoke . . . . . . . . . . . .  in org.apache.catalina.core.StandardWrapperValve
|    122 | invoke                          in org.apache.catalina.core.StandardContextValve
|    171 | invoke . . . . . . . . . . . .  in org.apache.catalina.core.StandardHostValve
|    103 | invoke                          in org.apache.catalina.valves.ErrorReportValve
|    116 | invoke . . . . . . . . . . . .  in org.apache.catalina.core.StandardEngineValve
|    408 | service                         in org.apache.catalina.connector.CoyoteAdapter
|   1070 | process . . . . . . . . . . . . in org.apache.coyote.http11.AbstractHttp11Processor
|    611 | process                         in org.apache.coyote.AbstractProtocol$AbstractConnectionHandler
|    316 | run . . . . . . . . . . . . . . in org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor
|   1145 | runWorker                       in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
|     61 | run                             in org.apache.tomcat.util.threads.TaskThread$WrappingRunnable
^    745 | run . . . . . . . . . . . . . . in java.lang.Thread

GSP代码:

                <g:each in="${fileList}" var="file">
                    <div>
                        <a href="#" onclick="remove('${file.attachmentId}')"> 
                        <span class="glyphicon glyphicon-remove"></span></a> 
                        <a href="/forms/landing/attachment/${file.attachmentId}" >${file.name}</a> 
                        </br>
                    </div>
                </g:each>

JAVASCRIPT代码:

function remove(attachmentId) {
    $(document).ready(function(){
            $('.glyphicon-remove').click ( function(e){
                e.preventDefault();
                $(this).parent().parent().remove();

                $.ajax({
                           url: "${g.createLink(controller: "landing", action: "deleteSelectedFile")}",
                            data: {
                                    attachmentId: attachmentId
                            },
                            success: function(data){
                                    alert("Success");
                            }

                       });

                 });
            });

        }

请帮帮我。在此先感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

天啊,

服务调用方法的返回类型无效。现在我明确地返回true。

现在正在运作。