【问题标题】:Can't deploy Grails War file in tomcat - results in 404无法在 tomcat 中部署 Grails War 文件 - 导致 404
【发布时间】:2014-07-03 02:02:35
【问题描述】:

我有一个GrailsApplication.war 文件,我将它添加到webapps 文件夹(tomcat 7)中。 当我尝试访问 url (<ipaddress>:8080/GrailsApplication) 时,它给了我一个 404 错误。我在部署 grails 战争文件时做错了什么?

Grails 版本:2.2.4

雄猫:7

服务器:Ubuntu

【问题讨论】:

  • 在Config.groovy 中是否为生产环境设置了相应的grails.serverURL?
  • 什么意思?对不起,我是初学者
  • 好的,添加为答案,因为评论太多了。 :)
  • 等一下。让我试试看。

标签: java tomcat grails tomcat7 war


【解决方案1】:

在 Grails 2 应用程序中,Config.groovy 中应该存在如下配置设置,验证是否存在:

environments {
    production {
        grails.serverURL = "http://<youripaddress>:8080/${appName}"
    }
}

【讨论】:

  • 它仍然给出 404。创建的 WAR 文件是 GrailsApplication_1.0.war,我将它放在 webapp 文件夹中。
  • 我也看到了这种行为。这个答案最终并没有解决我的问题。我正在使用 Grails 3.1.10。运行应用程序运行良好.. 部署战争不会以任何方式出错。无法通过 404。
  • @Kirby 答案不适用于 Grails 3.*。它仅适用于 Grails 2。
  • 你想达到什么目的?您还可以在 SO 中发布详细的问题,这将有助于获得更多关注并最终为您提供答案。
  • 我的 SO 在这里。谢谢您的回复。 :) stackoverflow.com/questions/41752633/…
【解决方案2】:

我相信 grails.serverURL 被 grails 用来生成 url,而不是作为配置来告诉 tomcat 哪个应用程序将解析为特定的 url。这由 tomcat 本身的配置处理。

试试这个:

http://yourdomain:port/GrailsApplication_1.0

然后看看你的应用程序是否出现

【讨论】:

    猜你喜欢
    • 2023-03-28
    • 2014-02-01
    • 2012-09-28
    • 1970-01-01
    • 1970-01-01
    • 2012-12-05
    • 1970-01-01
    • 1970-01-01
    • 2012-06-05
    相关资源
    最近更新 更多