Grails 2.5.3生产部署NPE(资产管道)

时间:2016-03-22 09:32:26

标签: grails asset-pipeline

当我尝试访问应用程序的登录页面时,我得到了以下stacktrace:

    21.03.2016 19:01:52,746: (HVK3) GrailsExceptionResolver: NullPointerException occurred when processing request: [GET] /wmp-hvk3-development/login/auth
Stacktrace follows:
org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: null
        at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:198)
        at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
        at grails.plugin.springsecurity.web.filter.GrailsAnonymousAuthenticationFilter.doFilter(GrailsAnonymousAuthenticationFilter.java:53)
        at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.java:62)
        at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.java:59)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
Caused by: java.lang.NullPointerException
        at java.util.Hashtable.hash(Hashtable.java:262)
        at java.util.Hashtable.get(Hashtable.java:459)
        at java.util.Properties.getProperty(Properties.java:951)
        at asset.pipeline.grails.AssetProcessorService.getResolvedAssetPath(AssetProcessorService.groovy:57)
        at asset.pipeline.grails.AssetProcessorService.asset(AssetProcessorService.groovy:72)
        at asset.pipeline.grails.CachingLinkGenerator.asset(CachingLinkGenerator.groovy:32)
        at asset.pipeline.grails.CachingLinkGenerator.resource(CachingLinkGenerator.groovy:24)
        at gsp_wmpHvk3Development_loginauth_gsp$_run_closure2.doCall(gsp_wmpHvk3Development_loginauth_gsp.groovy:67)

应用程序在本地工作站上的test environment中运行良好,但是当我部署到生产环境时会发生此堆栈跟踪。

我不知道该怎么做,我想自AssetProcessorService.groovy:57以来资产管道资产路径出现问题:

enter image description here

我在RedHat linux上使用java 1.7运行tomcat 7,资源管道2.7.2插件为compile依赖项和spring安全核心插件2.0.0 compile时间依赖。

1 个答案:

答案 0 :(得分:1)

这是由BuildConfig中缺少配置引起的。我在文件末尾添加了以下内容并修复了此问题:

// This closure is passed the command line arguments used to start the war process.
    grails.war.copyToWebApp = { args ->
        fileset(dir: "web-app") {
            include(name: "js/**")
            include(name: "css/**")
            include(name: "WEB-INF/**")
        }
    }