Sun GlassFish Enterprise Server v3 Prelude Developer's Guide

Deploying and Running a Grails Application

To deploy and run your application, perform one of these tasks:

ProcedureRunning a Grails Application Using run-app

  1. Go to the application directory.

    For example, go to the as-install/grails/samples/helloworld directory.

  2. Run the grails run-app command.

    The grails run-app command starts the Enterprise Server in the background and runs the application in one step. You don't need to create a WAR file or deploy your application.

  3. To test your application, point your browser to http://host:port/app-dir-name.

    For example, point to http://localhost:8080/helloworld. You should see a screen that begins, “Welcome to Grails.” Selecting the HelloController link should change the display to, “Hello World!”

See Also

For details about the grails run-app command, see the Sun GlassFish Enterprise Server v3 Prelude Reference Manual.

ProcedureRunning a Grails Application Using Standard Deployment

  1. Go to the application directory.

    For example, go to the as-install/grails/samples/helloworld directory.

  2. Create the WAR file in one of the following ways:

    • Run the grails war command.

      This command creates a large WAR file containing all the application's dependencies.

    • Run the grails shared-war command.

      This command creates a small WAR file, but requires referencing of the Grails library JAR at deployment.

    In the helloworld application, this step creates the helloworld-0.1.war file.

  3. Deploy the WAR file in one of the following ways:

    • In the Administration Console, open the Applications component, go to the Web Applications page, select the Deploy button, and type the path to the WAR file.

      The path to the helloworld WAR file is as-install/grails/samples/helloworld/helloworld-0.1.war.

      If you used the grails shared-war command, specify the as-install/grails/lib/glassfish-grails.jar file in the Libraries field.

    • On the command line, use the asadmin deploy command and specify the WAR file. For example:


      asadmin deploy helloworld-0.1.war

      If you used the grails shared-war command, specify the libraries using the --libraries option. For example:


      asadmin deploy --libraries $GRAILS_HOME/lib/glassfish-grails.jar helloworld-0.1.war
  4. To test your application, point your browser to http://host:port/war-file-name. Do not include the .war extension.

    For example, point to http://localhost:8080/helloworld-0.1. You should see a screen that begins, “Welcome to Grails.” Selecting the HelloController link should change the display to, “Hello World!”

See Also

For details about the Administration Console, see the online help.

For details about the asadmin deploy command, see the Sun GlassFish Enterprise Server v3 Prelude Reference Manual.

For details about the grails war and grails shared-war commands, see the Grails Quick Start.

For general information about deployment, see the Sun GlassFish Enterprise Server v3 Prelude Application Deployment Guide.