Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Grails to a Sub-Context Path

I would like to deploy a grails war to a sub context path but when I try this the application will not load and an error filterStart so I'm either missing something or grails can't be deployed to a sub-context. Is there any way to load grails in a sub context?

like image 863
Jeff Beck Avatar asked Feb 27 '23 14:02

Jeff Beck


1 Answers

I thought I'd leave an answer here for anyone who comes along since I've been trying to solve this problem myself.

One trick is to set use the hash/pound sign (#) in the .war file name:

api#1.2.war

Which results in the following app context:

http://localhost:8080/api/1.2/

I've tested this in Tomcat 7.

One reason why I wanted this is so that I can automatically ship different versions running side by side with the following grails BuildConfig.groovy:

grails.project.war.file = "target/api#${appVersion}.war"

This works great with Tomcat 7, I'm unsure about other versions.

However, what I would really like to do is set it up so that Tomcat uses the context from my Grails Config.groovy or application.properties files.

Update 1: I'm using Grails 1.3.7.

Update 2: Successfully tested by user miek in Tomcat 6. Thanks miek!

like image 196
Tony Day Avatar answered Mar 07 '23 21:03

Tony Day