Exit Print View

Sun GlassFish Enterprise Server v3 Scripting Framework Guide

  This Document Entire Library
Print View

Document Information

Preface

1.  Using JRuby on Rails With Sun GlassFish Enterprise Server

Introduction to JRuby and Rails on Sun GlassFish Enterprise Server

What Is Ruby on Rails ?

What Is JRuby ?

JRuby on Rails, the Sun GlassFish Enterprise Server v3, and the GlassFish v3 Gem

Installation and Configuration of JRuby

To Install JRuby and Rails from Update Center

To Install JRuby as Standalone

To Install Rails Gem on JRuby

Enterprise Server v3 JRuby Container Configuration

Configuring JRuby Container Through Asadmin CLI

Configuring JRuby Runtime Pool

Configuring JRuby Container Through Administration Console

To Configure JRuby Container from Administration Console

Creating a Simple Rails Application

To Create the hello Application

To Create the Controller and the View

To Pass Data From the Controller to the View

To Use Rails Without a Database

Deploying and Running a Rails Application

To Deploy the Rails Application as a Directory

Accessing a Database From a Rails Application

To Set Up the MySQL Database Server

To Create a Database-Backed Rails Application

Accessing Java Libraries From a Rails Application

To Create the Rails Application That Accesses Java Libraries

To Create the Views That Display the Images Generated by Java2D Code

To Add Java2D Code to a Rails Controller

To Run a Rails Application That Uses Java 2D Code

Monitor Rails Applications on Enterprise Server v3

Monitoring for JRuby Container

Viewing JRuby Container Statistics

GlassFish v3 Gem

To Install the GlassFish v3 Gem

To Run a Rails Application on GlassFish v3 Gem

To Deploy and Run the Database-Backed Web Application

Using GlassFish v3 Gem CLI

Introduction to Warbler

What Is Warbler ?

Creating and Deploying a Simple Rails Application with Warbler

To Create a Rails Application

To Deploy the WAR File

Further Information

2.  Developing Grails Applications

3.  Jython on Django

4.  Scala and Lift

5.  PHP

Installation and Configuration of JRuby

To develop and deploy Rails applications on the Enterprise Server, do the following:

  1. Download and install JRuby.

  2. Install Rails on top of your JRuby installation.

You can perform the above tasks by installing JRuby on your Enterprise Server instance in one of the following ways:

To Install JRuby and Rails from Update Center

JRuby and other associated Gems are now available as IPS packages from Update Center. By downloading them using the Update Tool, you can install them directly on your Enterprise Server.

For information about the Update Tool, see Sun GlassFish Enterprise Server v3 Installation Guide.

  1. Start the update tool:

    as-install/bin/updatetool

  2. From the Update Tool, choose the following packages from Available Add-Ons:

    • JRuby on GlassFish which contains JRuby 1.3.1

    • JRuby Gems which contains Rails 2.3.2, Warbler, jdbc-mysql, and activerecord-jdbcmysql-adapter packages.

  3. Click Install, which will install the packages on your Enterprise Server instance.

  4. Set your JRUBY_HOME environment variable to the location of your JRuby installation.

    export JRUBY_HOME=/jruby-install-location

  5. Add JRUBY_HOME/bin directory to your system path so that you can invoke JRuby from anywhere in your directory tree.

    export PATH=$PATH:$JRUBY_HOME/bin

  6. On the Windows operating system, use the following commands for Steps 4 and 5:

    set JRUBY_HOME=C:\jruby-install-location

    set PATH=%JRUBY_HOME%\bin;%PATH%


    Note - If GlassFish v3 JRuby IPS package was installed using update tool, then there is no need to set the jruby.home system property


To Install JRuby as Standalone

To install your own JRuby instance as standalone, use the following procedure.

  1. Go to JRuby download site JRuby Download Site.

  2. Download jruby-bin-1.3.1.zip or the latest version.

  3. Unpack the zip file:

    unzip jruby-bin-1.3.1.zip

  4. Set your JRUBY_HOME environment variable to the location of your JRuby installation:

    export JRUBY_HOME=/jruby-install-location

  5. Add JRUBY_HOME/bin directory to your system path so that you can invoke JRuby from anywhere in your directory tree:

    export PATH=$PATH:$JRUBY_HOME/bin

  6. If you want to use this JRuby installation with your Enterprise Server, use the following steps to inform and configure Enterprise Server instance with the location of the JRuby installation:

    1. Start your GlassFish installation:

      asadmin start-domain

    2. Set JRuby home:

      asadmin configure-jruby-container --jruby.home=/jruby-install-location

To Install Rails Gem on JRuby

If you installed your JRuby as a standalone instance, you also need to install the required Rails and other Gems on it. To install Rails, use the following procedure.