Deploying Grails applications on Tomcat
I just saw this blog entry about deploying Grails apps on Tomcat.
I’m confused as to why there is a need to "grails run-app" on the server.
I have deployed Grails applications many times now on Tomcat 5.5 on remote servers that don’t even have Grails installed. All that is required is dumping the .war into the webapps directory. To avoid problems I shut down tomcat first, copy the .war over, and then start tomcat again. It works without fail.
Here’s my shell script for doing this:
#!/bin/sh/etc/rc.d/init.d/tomcat5 stopsleep 10rm -Rf /opt/tomcat5-5.5.17/webapps/ROOTrm -f /opt/tomcat5-5.5.17/webapps/ROOT.warcp /home/marc/ApplicationName.war /opt/tomcat5-5.5.17/webapps/ROOT.war/etc/rc.d/init.d/tomcat5 start





















10 Comments
x-ray
May 11, 2007I have problems by deploying the application in TomCat
Using: TomCat 6 — grovvy 1.0 — grails 0.5
Application:
the tutorial form “Getting Started with Grails” you can download the book and sources from: http://www.infoq.com/minibooks/grails;jsessionid=A90BD951D5B0532F2B6B2CB26510D3E8
when i start the application from command line by using “grails run-app” the application starts and i can open it in a browser
our production server is a tomcat, so i try to published the grails project within tomcat … “grails war” –> using tomcat manager “Select WAR file to upload” –> try to start the uploaded project and get an error “FAIL – Application at context path /racetrack-0.1 could not be started”
How to run a Application on TomCat? Can you halp me, please?
x-ray
May 11, 2007… ok, the problem was the JVM Version, now tomcat the running status is TRUE
but! now are the problems calling a page “HTTP Status 404 – /racetrack-0.1/WEB-INF/grails-app/views/user/login.jsp” Why TomCat try to access to an JSP instead of GSP? …grrr
snaglepus
May 17, 2007I am not having any success deploying the war on a Mac 10.49. Tomcat just hangs on startup. After a while I get an WARNING message about Java Servlet 2.3 (nothing specific). Any ideas?
Lorenzo Jimenez
August 7, 2007Do Tomcat needs some library installed previously? After installing 0.5.8 and following a example in http://anchorvale.wordpress.com/2007/08/03/grails-quickstart/ I only get this error after inserting 2 records:
Message: No signature of method: Seminar.encodeAsHTML() is applicable for argument types: () values: {}
Caused by: No signature of method: Seminar.encodeAsHTML() is applicable for argument types: () values: {}
Class: Unknown
At Line: [-1]
Code Snippet:
Marc Palmer
August 9, 2007Guys… this isn’t a support forum! Get on the Grails user list, it’s the best place. Go to http://grails.org/Mailing+lists here and sub.
Quick answers though… Tomcat zombieing at startup… change your java options (usually the env var JAVA_OPTS) to something like “-server -Xmx512M”, you are likely seeing garbage collection problems. This will increase performance hugely for you during development also, so put export JAVA_OPTS=”-server -Xmx512M” or similar in your .bash_history or wherever you like so it is run before you do grails run-app.
Tomcat needs libs? Nope. Grails apps contain all their dependencies. The issue you are seeing is a classpath/dynamic metaclass issue that I think is known / fixed. Please ask on the mailing list.
Shane
February 1, 2008I believe he is calling run-app on his dev machine, not on the server.
Matt
February 10, 2009Marc I think you are getting lots of support questions as a google search for Grails + Tomcat puts your site as the #1 result
Marc Palmer
February 11, 2009Sweet… well that is partly because I’ve been around for a LONG time
Waseem Bashir
March 2, 2010hi there,
I want to implement SSL in grails. I cannot find the file /conf/server.xml in grails folder structure. Has any dev faced similar problem?
Much appreciated.
Marc Palmer
March 2, 2010Waseem – please ask on the Grails user mailing list: http://www.grails.org/Mailing+lists