Tag Archives: grails+tomcat

Deploying Grails app on Tomcat

Below I’m describing the steps to follow for deploying a grails web application in tomcat server instead of the default server that comes with the grails package.

Steps:

1. For deploying grails app on tomcat or any other application server we have to create a web archieve [.war file].

2. Before creating the war  file do any kind of configuration changes which you want , b’coz these cann’t be changed after generating the war file.

3. Also make sure that the line   “// TODO: grails.serverURL = http://www.changeme.com in file “appname\grails-app\conf \Config.groovy” is commented or is set to  appropriate url if running live  by default the                     line is commented and hence no modification is needed  for  testing on localhost.

4 .Now create the war file by type  “ grails prod war”

5. Now check the appname/target directory you will see a war file there

Ex: if app name is Gregister the a file Gregister-0.1.war will be there.

Rename the war file  from Gregister-0.1.war to Gregister[ using which you were deploying it originally].

6. Place this file in  “webapps” directory of tomcat.

7. Start tomcat.

8. Click Manage App button    tomcat manage apps

9 .Enter Login details

10. A table with name Applications is there which shows the  list of all applications . apache managerwebapps

11. In this table Click in the path column on the row corresponding to your application

Ex: /Gregister in this case. //screenshot available

12. You wil be directed automatically to the home page of the grails app and you can use the grails app similar as running using grails framework.grails workingapp

13. If the application name is not listed in the Applications table then  goto War file to deploy table on the same page

.click choose file and select the war file in web apps directory

.click deploy and refresh page and follow above steps to deploy

14. One thing to note is that this time the application runs on the port on which tomcat is installed Ex: http://localhost:8011  [here 8011 is the port on which I installed tomcat].