1. Using JRuby on Rails With Sun GlassFish Enterprise Server
Introduction to JRuby and Rails on Sun GlassFish Enterprise Server
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
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
To Install the GlassFish v3 Gem
To Run a Rails Application on GlassFish v3 Gem
To Deploy and Run the Database-Backed Web Application
The procedure for creating a simple Rails application for Warbler, is similar to
the procedure described in Creating a Simple Rails Application.
Create a new directory for the Warbler application. For example:
mkdir rails-warbler
Change to rails-warbler directory and create a sample application called hello:
jruby -S rails hello
Edit the enviroment.rb file to indicate that your application does not use a database:
Open rails-warbler/hello/config/environment.rb in a text editor.
Remove the pound character (#) in front of line 21 to uncomment it so that it reads as follows and save:
config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
Exit and save the file.
Use Warbler to create a war file in rails-warbler/hello application directory:
jruby -S warble
This creates a hello.war file in the directory.
Change to the rails-warbler/hello application directory.
Deploy the application WAR file to the Enterprise Server by running the asadmin command:
asadmin deploy hello.war
Run the hello application by entering the following URL in your browser:
http://<hostname>:<port>/hello