404 when deploying Grails 3.1.10 war to tomcat7 or tomcat8

一曲冷凌霜 提交于 2019-12-08 05:59:44

问题


The closest stackoverflow question that explains my symptoms is here - How can I deploy a Grails 3.0.1 war file in Tomcat7?

I am in the process of upgrading a Grails 2.3.4 application to Grails 3.1.10 and everything is working with 'grails run-app'.

When i deploy to a war i get nothing but 404's for any url.

The war deploys without any error messages in catalina.out.

The tomcat access logs show my access attempts. (not linux problem?)

I can get to the tomcat manager, and the tomcat manager shows my app as "running" as true. (no errors)

Manager shows myapp-0.1 because the war file was myapp-0.1.war .. this is fine for now.

I am running Grails 3.1.10.

I have tried against Tomcat 7.0.55 as well as 8.0.92.

I have tried changing grails.serverUrl in application.groovy to various values. It is now:

//fix war name after get working
grails.serverUrl = "/myapp-0.1"
System.setProperty("server.contextPath","/myapp-0.1")

I have tried the above without "-0.1". (i was suprised to learn this was necessary - https://stackoverflow.com/a/23664531/104993)

I have tried changing "org.springframework.boo:spring-boot-starter-tomcat" from "compile" to "provided" in the build.gradle file.

Please let me know what I need to elaborate on. It's difficult to paste log outputs and config files. (i'm behind a firewall)


回答1:


You add the following task to your build.gradle it will name the war what ever you want:

task wrapper(type:Wrapper){
     war.archiveName='myWar.war'
}

Then when you deploy it should have the correct name and you can go to https://localhost:8080/myWar



来源:https://stackoverflow.com/questions/41752633/404-when-deploying-grails-3-1-10-war-to-tomcat7-or-tomcat8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!