UPDATE (Feb 14)
v3 Gem allows JRuby-on-Rails application to be launched in GlassFish
v3 server. It provides a robust alternative to WEBrick and
for development and deployment of your JRuby-on-Rails applications.
: A 0.1.1 version
of the gem is released which will change the installation process.
Gem was originally announced here
and then updated here
All along, the Gem was living a nomadic life on download.java.net
Now it has found a permanent home on http://rubyforge.org/projects/glassfishgem/
We are excited to release version 0.1.0 of Gem co-located with other
standard gems such as RubyGems
This new and permanent home provides a much more seamless installation
of v3 gem. Here are the highlights:
How to install the Gem ?
- The Gem replaces WEBrick as the development container and a
pack of Mongrels front-ended by light-weight
Web server +
Capistrano for management by one command and one process (think
- Works with both JRuby
1.0.3 and JRuby
applications can be deployed in one instance of gem, each in their own
context root and running on separate ports (details below).
- Each application can serve multiple requests concurrently.
This can be configured by the number of JRuby runtimes using
as a command-line property (details below).
- The applications deployed on this Gem can easily make use
of pooled resources such as database connections as explained in TOTD
- The released version is 0.1.0. Even though a preview
version of Gem was released
earlier, the version number is starting from scratch because
of the newly found permanent home.
- Installing the Gem is a seamless and integrated process as
you've downloaded and unzipped JRuby 1.0.3, go to JRUBY_HOME directory
and install the gem by giving the following command:
bin/jruby -S gem install GlassFish
Need to update 24 gems from http://gems.rubyforge.org
Select which gem to install for your platform (java)
1. GlassFish 0.1.0 (java)
2. Skip this gem
3. Cancel installation
Successfully installed GlassFish-0.1.0-java
Once the gem is installed, "
script is available in
directory. The exact same commands work for installing the gem in JRuby
1.1RC1 as well.
How to deploy an
application on Gem ?
shows how to develop a JRuby-on-Rails applications with
JRuby 1.0.3 and JRuby 1.1 RC1 and tested using WEBrick
To deploy these applications on the newly installed gem, use the
cd .. (go to parent directory of the application)
jruby -S glassfish_rails hello
Now the app is deployed at "
How to configure the
number of concurrent requests ?
default number of concurrent requests that can be handled by an
application deployed Gem is
1. If your application hosted on the Gem needs to handle concurrent
requests then you need to specify the command-line option "
where NNN is
the number of expected concurrent requests. For example, if your
application needs to handle 4 concurrent requests then the command to
host your application will look like:
jruby -J-Djruby.runtime=4 -S glassfish_rails hello
How to host multiple
Multiple applications can be hosted on GlassFish gem by modifying the
default port number on which the Gem is started. The ports that need to
be changed are: "
For now, the port numbers need to be modified by manually editing "
file. Search for the string in first column, replace the port attribute
of that XML element with the value in second column and the third
column shows the default value:
Any subsequent application deployed on GlassFish
gem will now be hosted on
where <context-root> is the name of your Rails
A command-line switch, similar "
will be provided in
the near future.
Please use the gem and send us feedback on GlassFish
File issues in JIRA
v3 gem rubyforge