Posts Tagged ‘tomcat’

Deploy Grails Apps in 3 simple steps on Tomcat and MySQL

February 5, 2011 3 comments

For a Grails project we use Tomcat for our demo environment on Windows. Our Grails App is using MySQL as datasource. Here are 3 simple steps to get your Grails Apps deployed.

Needed Software

  • Java JRE version (We assume you have already Java installed, so that you can skip this step). If not download and install
  • WampServer 2.1e (32 bits) of WampServer 2.1d (64 bits) download
  • Tomcat version 7.0.6. download
  • And of course you need the Grails war file and probably some db scripts for MySQL database

Step 1 Installing WampServer

The WampServer package is delivered whith the latest releases of Apache, MySQL and PHP. Double click on the downloaded file and just follow the instructions. Everything is automatic. Once WampServer is installed, you can run some create- or datascripts to MySQL with the known phpMyAdmin tool. IMPORTANT: If port 80 is already in use, you can change the port in the httpd.conf file. Test if the url http://localhost/ is ok. Or if you change the port for example use http://localhost:99/

Step 2 Installing Tomcat

Installing Tomcat on Windows can be done easily using the Windows installer. Its interface and functionality is similar to other wizard based installers, with only a few items of interest. Installation as a service: Tomcat will be installed as a Windows service no matter what setting is selected. The installer will use the registry or the JAVA_HOME environment variable to determine the base path of a Java JRE. The installer will create shortcuts allowing starting and configuring Tomcat. It is important to note that the Tomcat administration web application can only be used when Tomcat is running. If  port 8080 is already in use you can change this during the install or later in the server.xml file in the Tomcat/conf directory. Test if the url http://localhost:8080/ is ok. Or if you change the port for example use http://localhost:8099/

Step 3 Deploy the Grails war file

  • Start Tomcat with the url http://localhost:8080/ or another port
  • Click on manager webapp and logon
  • Choose the file to select the Grails war file and click deploy
  • If succes, the application must appear in the list and is started
  • check this on http://localhost:8080/<appname&gt;

Congratulations your Grails App is deployed now!


Q: Portnumber is already in use?
A: Change in httpd.conf in case of Apache, change in server.xml in case of Tomcat

Q: Get errors during phpMyAdmin because sql file is greater than 2MB?
A: change the value of parameter upload_max_filesize for exapmple to 4MB

Q: Tomcat in log files out of PermSize?
A: On commandline use for example C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin>tomcat7 //US//Tomcat7 –JvmMx 1024 ++JvmOptions=”-XX:MaxPermSize=512m” to set the MaxPermSize to 512m

Goto to the blog of  mrhaki to read the artikels in Grails Goodness regarding Grails WAR files in combination with Tomcat

%d bloggers like this: