Last updated by
5 years ago
Page: Deployment, Version:1
Deployment
Grails should never be deployed using the {{grails run-app}} command as this sets Grails up in "development" mode which has additional overheads. To deploy a Grails application type:grails war
If memory is not a problem on your server then allocate a large amount of memory, such as 512M or more. Also use the server VM option. EG: (-server -Xms512M -Xmx512M). Usually it is better to set both min and max heap size to the same in server applications.However, if you running on a virtual host with limited memory, Grails 1.0 RC1 has been tested on tomcat 6 with both -Xmx96M and -Xmx128M, it performed well with both settings. I've heard reports of it running on lesser configurations. See: Grails Test On Virtual Server for more information.
Container Support Matrix
| Container | Grails 1.0 |
|---|---|
| #Tomcat 5.5 | (/) |
| #Tomcat 6.0 | (/) |
| Geronimo 2.0.2 | (?) |
| #GlassFish v1 (Sun AS 9.0) | (/) |
| #GlassFish v2 (Sun AS 9.1) | (/) |
| #GlassFish v3 | (/) |
| #Sun App Server 8.2 | (/) |
| Websphere 6.1 | (/) |
| Resin 3.2 | (/) |
| Oracle AS | (/) |
| JBoss 4.2 | (/) |
| Jetty 6.1 | (/) |
| SpringSource Application Platform 1.0 beta | (/) |
| Weblogic 8.1.2 | (x) |
Deployment Notes
Tomcat
Tomcat deployment is trivial and requires copying the WAR file into the TOMCAT_HOME/webapps folder and restarting the container.GlassFish">GlassFish
To deploy a Grails application into GlassFish v1 ( Sun Java System Application Server 9.0), Glassfish v2 ( Sun Java System Application Server 9.1 Update 1 and 2 ) and GlassFish v3- Take the WAR file and drop it in the autodeploy directory of the domain onto which you wish to deploy. For example $GLASSFISH_HOME/domains/domain1/autodeploy
- Invoke asadmin command as: asadmin deploy myapp-0.1.war
Access your application at http://localhost:8080/myapp-0.1To undeploy invoke asadmin undeploy myapp-0.1For latest on Groovy/Grails support in GlassFish, visit Groovy and Grails in GlassFish Wiki .
Sun App Server 8.2
Follow the same instructions as deployment onto GlassFish above. However, Sun App Server 8.2 has a bug relating to <welcome-file-list> definitions. Essentially it routes all requests for static resources like images to the GSP servlet so a URL like:http://localhost:8080/amazon-0.1/images/grails_logo.jpgGoes to:http://localhost:8080/amazon-0.1/images/grails_logo.jpg/index.gspThere seem to be known problems with this version of Sun App Server and a welcome file list definition.http://forum.java.sun.com/thread.jspa?threadID=5135956&tstart=135If you dograils install-templates
Websphere 6.1
- Access the WebSphere integrated console typically at a location like: http://localhost:9060/ibm/console
- Select Applications/Install New Application
- Browse for the WAR file and then enter a context path that matches the name of the WAR. For example if you have a myapp-0.1.war then enter /myapp-0.1 as the context path
- Keep clicking "Next" and then click "Finish" to complete
- Go back to Applications/Enterprise Applications select the checkbox next to the app you just installed and click the "Start" button
- You should now be able to access the application via the port you installed WebSphere's HTTP listener on. For example: http://localhost:9080/myapp-0.1/
I get a org.apache.commons.logging.LogConfigurationException what happened?
When trying to load a WAR file on WAS 6 and selecting "Parent last" as the classloader option, some users report the following error:Caused by: org.apache.commons.logging.LogConfigurationException: The chosen LogFactory implementation does not extend LogFactory. Please check your configuration...
- Delete commons-logging-1.1.jar from the lib directory
- Add commons-logging-adapters-1.1.jar to the lib directory
- After adding the application, modify the classloader to "Parent last."
I get an error like 'java.lang.NoSuchMethodError: org.apache.tools.ant.UnknownElement: method setNamespace(Ljava/lang/String;)V not found' what do I do?
WebSphere ships with an old version of ant.jar in $WASHOME/lib You will see errors like 'java.lang.NoSuchMethodError: org.apache.tools.ant.UnknownElement: method setNamespace(Ljava/lang/String;)V not found'. Workaround: replace the ant.jar with a more recent version of ant (e.g. from GRAILS_HOME/lib).I'm getting a 500 error code when I try to access my application
- Check that you have patched WebSphere with the latest fixpack (6.1.0.11 or later)
- Set the the property 'com.ibm.ws.webcontainer.invokefilterscompatibility' to 'true' (Servers -> Application Servers -> <server> -> Web Container Settings -> Web Container -> Custom Properties)
- Restart WAS, the 500 should only happen now on the first page, if you append index.gsp to the URL it should work
- Create a file index.html under the webapp directory with the following content :
<html> <head> <meta HTTP-EQUIV="REFRESH" content="0; url=index.gsp"> </head> <body/> </html>
- Install the templates with the command :
grails install-templates
- Modify the <welcome-file-list> section of the file src/templates/war/web.xml with :
<welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list>
- Repackage and redeploy your application