当我们通过“grails”运行它时,我们有一个运行良好的应用程序。但是,当我们构建并部署war时,任何请求的URL都会出现404错误(例如,"/index.gsp“未找到)。
可能是什么原因?
grails run-app 好的
grails war 404错误,资源不可用
grails test run-war 404错误,资源不可用
下面是插件配置:
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.7'
compile ":asset-pipeline:1.9.9"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.5.5" // or ":hibernate:3.6.10.17"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
// Uncomment these to enable additional asset-pipeline capabilities
//compile ":sass-asset-pipeline:1.9.0"
//compile ":less-asset-pipeline:1.10.0"
//compile ":coffee-asset-pipeline:1.8.0"
//compile ":handlebars-asset-pipeline:1.3.0.3"
}发布于 2014-11-28 10:05:38
通过将过滤器从包中移出解决。
发布于 2014-11-27 22:36:32
您的开发环境(Windows)是什么?您的目标环境是什么(Unix,Linux?)。我不得不在目标环境(Linux)上重新编译WAR文件,因为我在Windows创建的WAR文件中没有找到类似的资源问题。
幸运的是,我为Windows下载的Grails也在Unix上工作(都需要一个JVM才能运行)。因此,尝试将Grails复制到目标环境,并遵循以下步骤:
grails create-app your-project-name
grails clean-allgrails refresh-dependenciesgrails compilegrails prod war我怀疑其中一个库(比如Oracle的ojdbc6.jar)依赖于本地系统调用,这些调用在迁移到不同的操作系统时需要重新编译。
希望这能有所帮助。
https://stackoverflow.com/questions/27176125
复制相似问题