Login required
Download

Apache Tomcat plugin for Grails

(5)
Author(s): Graeme Rocher
Current Release: 1.2-M2
Grails Version: 1.1 > *
Tags server tomcat
grails install-plugin tomcat
This plugin replaces Jetty with Tomcat as the default development time server for Grails. To install simply type:

grails install-plugin tomcat

The regular Grails commands like run-app etc. will operate against Tomcat instead of Jetty. No other installation of an external Tomcat distribution is required.

The following two features (JNDI/remote deployment) require the latest 1.2-SNAPSHOT version of the plugin:

grails install-plugin tomcat 1.2-SNAPSHOT

JNDI

You can specify JNDI naming entries to be used by the embedded Tomcat in your grails-app/conf/Config.groovy file:

grails.naming.entries = [foo:"bar"]

These can then be looked up by configuring an appropriate Spring bean in @grails-app/conf/resources.groovy@:

beans = {
  xmlns jee:"http://www.springframework.org/schema/jee"
  jee.'jndi-lookup'(id:"foo", 'jndi-name':"java:comp/env/foo")
}

Note if you deploy to a standalone Tomcat instance then these with need to be configured in your Tomcat context.xml file as per the Tomcat documentation

Remote Deployment

The plugin features remote deployment Gant scripts. To deploy the current Grails application simply run:

grails tomcat deploy

To undeploy run:

grails tomcat undeploy

Note you will need to configure permissions in your tomcat-users.xml directory such as:

<role rolename="manager"/>
<user username="manager" password="secret" roles="standard,manager"/>

You can then need to specify the username/password (and potentially url) in your Config.groovy file:

tomcat.deploy.username="manager"
tomcat.deploy.password="secret"
tomcat.deploy.url="http://myserver.com/manager"
How do I deploy to the root context of a Tomcat installation? In your application.properties, set your app.name=ROOT