java.lang.NullPointerException:无法执行null + null

时间:2016-02-11 15:20:55

标签: spring grails groovy

我收到了一个使用spring框架的遗留groovy应用程序。

我已经安装了grails 2.4.2来运行应用程序(我认为应用程序是在这个版本的grails上编写的)

当我尝试使用mvn grails:run-app运行它时。它会抛出错误

9:18:04.354 [localhost-startStop-1] INFO  o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [metricsContext.xml]

Configuring Spring Security Core ...
... finished configuring Spring Security Core

Configuring Spring Security CAS ...
09:18:04.741 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
java.lang.NullPointerException: Cannot execute null+null
    at org.codehaus.groovy.runtime.NullObject.plus(NullObject.java:132) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.NullObject$plus.call(Unknown Source) ~[na:na]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:32) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) ~[groovy-all-2.3.3.jar:2.3.3]
    at SpringSecurityCasGrailsPlugin$_closure2_closure9.doCall(SpringSecurityCasGrailsPlugin.groovy:131) ~[plugin-classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1085) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1110) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.Closure.call(Closure.java:423) ~[groovy-all-2.3.3.jar:2.3.3]
    at grails.spring.BeanBuilder.invokeBeanDefiningMethod(BeanBuilder.java:703) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:561) ~[grails-spring-2.4.2.jar:2.4.2]
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects(ClosureMetaClass.java:423) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:346) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145) ~[groovy-all-2.3.3.jar:2.3.3]
    at SpringSecurityCasGrailsPlugin$_closure2.doCall(SpringSecurityCasGrailsPlugin.groovy:129) ~[plugin-classes/:na]
    at SpringSecurityCasGrailsPlugin$_closure2.doCall(SpringSecurityCasGrailsPlugin.groovy) ~[plugin-classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_79]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_79]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_79]
    at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_79]
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) ~[groovy-all-2.3.3.jar:2.3.3]
    at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:909) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.Closure.call(Closure.java:423) ~[groovy-all-2.3.3.jar:2.3.3]
    at groovy.lang.Closure.call(Closure.java:417) ~[groovy-all-2.3.3.jar:2.3.3]
    at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:754) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.beans(BeanBuilder.java:584) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:527) ~[grails-spring-2.4.2.jar:2.4.2]
    at org.codehaus.groovy.grails.plugins.DefaultGrailsPlugin.doWithRuntimeConfiguration(DefaultGrailsPlugin.java:511) ~[grails-core-2.4.2.jar:2.4.2]
    at org.codehaus.groovy.grails.plugins.AbstractGrailsPluginManager.doRuntimeConfiguration(AbstractGrailsPluginManager.java:123) ~[grails-core-2.4.2.jar:2.4.2]
    at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:154) ~[grails-web-2.4.2.jar:2.4.2]
    at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127) ~[grails-web-2.4.2.jar:2.4.2]
    at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:126) ~[grails-web-2.4.2.jar:2.4.2]
    at org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener.initWebApplicationContext(GrailsContextLoaderListener.java:109) ~[grails-web-2.4.2.jar:2.4.2]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
09:18:04.744 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
java.lang.NullPointerException: Cannot execute null+null
    at SpringSecurityCasGrailsPlugin$_closure2_closure9.doCall(SpringSecurityCasGrailsPlugin.groovy:131) ~[plugin-classes/:na]
    at grails.spring.BeanBuilder.invokeBeanDefiningMethod(BeanBuilder.java:703) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:561) ~[grails-spring-2.4.2.jar:2.4.2]
    at SpringSecurityCasGrailsPlugin$_closure2.doCall(SpringSecurityCasGrailsPlugin.groovy:129) ~[plugin-classes/:na]
    at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:754) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.beans(BeanBuilder.java:584) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:527) ~[grails-spring-2.4.2.jar:2.4.2]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
09:18:04.745 [localhost-startStop-1] ERROR o.c.g.g.w.c.GrailsContextLoaderListener - Error initializing the application: Cannot execute null+null
java.lang.NullPointerException: Cannot execute null+null
    at SpringSecurityCasGrailsPlugin$_closure2_closure9.doCall(SpringSecurityCasGrailsPlugin.groovy:131) ~[plugin-classes/:na]
    at grails.spring.BeanBuilder.invokeBeanDefiningMethod(BeanBuilder.java:703) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:561) ~[grails-spring-2.4.2.jar:2.4.2]
    at SpringSecurityCasGrailsPlugin$_closure2.doCall(SpringSecurityCasGrailsPlugin.groovy:129) ~[plugin-classes/:na]
    at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:754) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.beans(BeanBuilder.java:584) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:527) ~[grails-spring-2.4.2.jar:2.4.2]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
09:18:04.745 [localhost-startStop-1] ERROR o.c.g.g.w.c.GrailsContextLoaderListener - Error initializing Grails: Cannot execute null+null
java.lang.NullPointerException: Cannot execute null+null
    at SpringSecurityCasGrailsPlugin$_closure2_closure9.doCall(SpringSecurityCasGrailsPlugin.groovy:131) ~[plugin-classes/:na]
    at grails.spring.BeanBuilder.invokeBeanDefiningMethod(BeanBuilder.java:703) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:561) ~[grails-spring-2.4.2.jar:2.4.2]
    at SpringSecurityCasGrailsPlugin$_closure2.doCall(SpringSecurityCasGrailsPlugin.groovy:129) ~[plugin-classes/:na]
    at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:754) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.beans(BeanBuilder.java:584) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:527) ~[grails-spring-2.4.2.jar:2.4.2]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
09:18:04.746 [localhost-startStop-1] ERROR o.a.c.c.C.[.[localhost].[/welcome] - Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NullPointerException: Cannot execute null+null
    at org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener.initWebApplicationContext(GrailsContextLoaderListener.java:126) ~[grails-web-2.4.2.jar:2.4.2]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) ~[spring-web-4.0.5.RELEASE.jar:4.0.5.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) [tomcat-embed-core-7.0.54.jar:7.0.54]
    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_79]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_79]
    at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79]
Caused by: java.lang.NullPointerException: Cannot execute null+null
    at SpringSecurityCasGrailsPlugin$_closure2_closure9.doCall(SpringSecurityCasGrailsPlugin.groovy:131) ~[plugin-classes/:na]
    at grails.spring.BeanBuilder.invokeBeanDefiningMethod(BeanBuilder.java:703) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:561) ~[grails-spring-2.4.2.jar:2.4.2]
    at SpringSecurityCasGrailsPlugin$_closure2.doCall(SpringSecurityCasGrailsPlugin.groovy:129) ~[plugin-classes/:na]
    at grails.spring.BeanBuilder.invokeBeanDefiningClosure(BeanBuilder.java:754) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.beans(BeanBuilder.java:584) ~[grails-spring-2.4.2.jar:2.4.2]
    at grails.spring.BeanBuilder.invokeMethod(BeanBuilder.java:527) ~[grails-spring-2.4.2.jar:2.4.2]
    ... 4 common frames omitted
09:18:04.747 [localhost-startStop-1] ERROR o.a.catalina.core.StandardContext - Error listenerStart
09:18:04.758 [localhost-startStop-1] ERROR o.a.catalina.core.StandardContext - Context [/welcome] startup failed due to previous errors
09:18:04.760 [localhost-startStop-1] INFO  o.s.w.c.s.XmlWebApplicationContext - Closing Root WebApplicationContext: startup date [Thu Feb 11 09:18:02 CST 2016]; root of context hierarchy
09:18:04.771 [main] INFO  o.a.coyote.http11.Http11Protocol - Starting ProtocolHandler ["http-bio-8080"]

我找到了这个帖子

Grails: Spring Security CAS working in 2.2.3 but not in 2.3.0

并在我的Config.groovy中添加了这些行,但这并没有解决问题

1 个答案:

答案 0 :(得分:0)

这些属性可能null

// must be set, e.g. '/login'
grails.plugins.springsecurity.cas.loginUri = null 
// must be set, e.g. 'http://localhost:8080/myapp/j_spring_cas_security_check'
grails.plugins.springsecurity.cas.serviceUrl = null