Skip to main content

GlassFish v3 Gem Updated

Posted by arungupta on January 5, 2008 at 6:25 AM PST

Pramod published an updated href="">JRuby
Gem for GlassFish v3. Download the gem href="">here.

Here are the updates from href="">last

  1. The Gem is now smaller - 2.4 MB instead of 2.9 MB (approx
    20% smaller).
  2. The Gem is now using the latest v3 codebase, including
    Grizzly JRuby module 1.6.1.
  3. 2 Rails instances are created instead of the default one.
    So now 2 requests can be invoked in parallel and they both will be
    served instead of returning a blank page for the pending request. This
    explains/resolves the issue reported href="">here.
  4. The list of known issues is now available

    1. href="">#3856
      - Default Rails page gives 404
    2. href="">#3964
      - Option to specify port at the command-line
    3. href="">#3965
      - Port conflict should be resolved transparently
    4. href="">#3966
      - Blank page returned if no Rails instance is available
    5. href="">#3968
      - Provide a means to configure number of Rails instances
    6. href="">#3971
      - Usage of v3 gem needs to be consistent with WEBrick

    Please href="">file
    bugs if you see any other issues.

Ad of course, you can href="">BYOG
(Build style="font-weight: bold;">Your style="font-weight: bold;">Own style="font-weight: bold;">Gem :)

Either way, once the Gem is installed then go ahead and use it as

  1. Create a template app as:

    jruby -S rails hello
  2. Create a controller and view as:

    cd hello

    jruby script/generate controller say hello
  3. Edit controller as:

    vi app/controllers/say_controller.rb

    and add the following variable in hello helper method:

    @hello_string = "v3 Gem is getting polished!"
  4. Edit view as:

    vi app/views/say/hello.rhtml

    and add the following string at the bottom:

    <%= @hello_string %>
  5. Ad deploy the application on GlassFish v3 gem as:

    cd ..

    jruby -S glassfish_rails hello

That's it! The following output in the console confirms successful
start of the Gem:

Jan 4, 2008 3:35:52 PM
com.sun.grizzly.standalone.StaticResourcesAdapter <init>

INFO: New Servicing page from:

Jan 4, 2008 3:36:00 PM com.sun.enterprise.v3.server.AppServerStartup run

INFO: Startup service : Application Loader

Jan 4, 2008 3:36:00 PM com.sun.enterprise.v3.server.AppServerStartup run

INFO: Startup service : Grizzly on port 8080

Jan 4, 2008 3:36:00 PM com.sun.enterprise.v3.server.AppServerStartup run

INFO: Glassfish v3 started in 8567 ms

The application is deployed at http://localhost:8080/hello/say/hello
and shows the output as:

alt="GlassFish v3 gem - Simple App output"
title="GlassFish v3 gem - Simple App output"

And http://localhost:8080/hello is displayed
in the browser as shown below:

alt="Default Rails page with v3 gem"
title="Default Rails page with v3 gem"

And you can try more advanced applications like href="">Mephisto
as described here.

Technorati: href="">ruby href="">jruby href="">glassfish
v3 href="">gem

Related Topics >>