Monday Nov 17, 2008

TOTD #53: Scaffold in Merb using JRuby/GlassFish


GlassFish Gem 0.9.0 can be used to run Rails and Merb applications. Support another Rack-based framework Sinatra is coming up in the near future. This blog shows how to create a scaffold in Merb and run it using the GlassFish gem.



Merb allows pluggable ORM and comes with DataMapper as the default one. However DataMapper has native dependencies and so cannot be used with JRuby. There is discussion about creating a DataMapper adapter over JDBC but in the meanwhile ActiveRecord is the only ORM that can be used with JRuby.

Merb wiki has extensive documentation but lacks clearly defined steps for generating scaffold when using ActiveRecord. This blog fulfills those gaps and provides a comprehensive tutorial to build a Merb scaffold.
  1. Lets create a Merb application using ActiveRecord ORM as:

    ~/samples/jruby/merb >~/tools/jruby-1.1.5/bin/jruby -S merb-gen core --orm activerecord hello
    Generating with core generator:
         [ADDED]  gems
         [ADDED]  merb.thor
         [ADDED]  .gitignore
         [ADDED]  public/.htaccess
         [ADDED]  doc/rdoc/generators/merb_generator.rb
         [ADDED]  doc/rdoc/generators/template/merb/api_grease.js
         [ADDED]  doc/rdoc/generators/template/merb/index.html.erb
         [ADDED]  doc/rdoc/generators/template/merb/merb.css
         [ADDED]  doc/rdoc/generators/template/merb/merb.rb
         [ADDED]  doc/rdoc/generators/template/merb/merb_doc_styles.css
         [ADDED]  doc/rdoc/generators/template/merb/prototype.js
         [ADDED]  public/favicon.ico
         [ADDED]  public/merb.fcgi
         [ADDED]  public/robots.txt
         [ADDED]  public/images/merb.jpg
         [ADDED]  Rakefile
         [ADDED]  app/controllers/application.rb
         [ADDED]  app/controllers/exceptions.rb
         [ADDED]  app/helpers/global_helpers.rb
         [ADDED]  app/views/exceptions/not_acceptable.html.erb
         [ADDED]  app/views/exceptions/not_found.html.erb
         [ADDED]  autotest/discover.rb
         [ADDED]  autotest/merb.rb
         [ADDED]  autotest/merb_rspec.rb
         [ADDED]  config/init.rb
         [ADDED]  config/rack.rb
         [ADDED]  config/router.rb
         [ADDED]  config/environments/development.rb
         [ADDED]  config/environments/production.rb
         [ADDED]  config/environments/rake.rb
         [ADDED]  config/environments/staging.rb
         [ADDED]  config/environments/test.rb
         [ADDED]  public/javascripts/application.js
         [ADDED]  public/stylesheets/master.css
         [ADDED]  spec
         [ADDED]  app/views/layout/application.html.erb
  2. Generate a Merb resource (model, controller and associated things):

    ~/samples/jruby/merb/hello >merb-gen resource Runner distance:float,minutes:integer
    Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
    Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
    Generating with resource generator:
    Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
    Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
    Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
    Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
    Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
    Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
    Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
    Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
         [ADDED]  spec/models/runner_spec.rb
         [ADDED]  app/models/runner.rb
         [ADDED]  schema/migrations/001_runner_migration.rb
         [ADDED]  spec/requests/runners_spec.rb
         [ADDED]  app/controllers/runners.rb
         [ADDED]  app/views/runners/index.html.erb
         [ADDED]  app/views/runners/show.html.erb
         [ADDED]  app/views/runners/edit.html.erb
         [ADDED]  app/views/runners/new.html.erb
         [ADDED]  app/helpers/runners_helper.rb
    resources :runners route added to config/router.rb

    As evident from the generated files Model, Controller, Helper and Views are generated. The Views are only template files with no code because this code end up getting changed anyway most of the times. Instead template Views can be written as explained in CRUD View Examples (more on this later).
  3. Configure Database
    1. Merb applications do not have a pre-generated "database.yml" so create one as:

      ~/samples/jruby/merb/hello >rake db:create
      (in /Users/arungupta/samples/jruby/merb/hello)
      JRuby limited openssl loaded. gem install jruby-openssl for full support.
      http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
      Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
      Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
      Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
      Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
       ~ It took: 0
       ~ Loading: Merb::BootLoader::MixinSession
       ~ It took: 0
       ~ Loading: Merb::BootLoader::BeforeAppLoads
       ~ It took: 0
       ~ Loading: Merb::Orms::ActiveRecord::Connect
       ~ No database.yml file found in /Users/arungupta/samples/jruby/merb/hello/config.
       ~ A sample file was created called database.yml.sample for you to copy and edit.
    2. Copy "config/database.yml.sample" to "config/database.yml". Wonder why this step is explicitly required ?
    3. Edit database configuration such that it looks like:

      :development: &defaults
        :adapter: mysql
        :database: hello_development
        :username: root
        :password:
        :host: localhost
        :socket: /tmp/mysql.sock
        :encoding: utf8

      The changed lines are shown in bold.
    4. Create the database as:

      ~/samples/jruby/merb/hello >rake db:create
      (in /Users/arungupta/samples/jruby/merb/hello)
      JRuby limited openssl loaded. gem install jruby-openssl for full support.
      http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
      Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
      Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
      Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
      Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
       ~ It took: 0
       ~ Loading: Merb::BootLoader::MixinSession
       ~ It took: 0
       ~ Loading: Merb::BootLoader::BeforeAppLoads
       ~ It took: 0
       ~ Loading: Merb::Orms::ActiveRecord::Connect
       ~ Connecting to database...
       ~ It took: 0
       ~ Loading: Merb::BootLoader::LoadClasses
       ~ It took: 0
       ~ Loading: Merb::BootLoader::Router
       ~ Compiling routes...
       ~ It took: 0
       ~ Loading: Merb::BootLoader::Templates
       ~ It took: 0
       ~ Loading: Merb::BootLoader::MimeTypes
       ~ It took: 0
       ~ Loading: Merb::BootLoader::Cookies
       ~ It took: 0
       ~ Loading: Merb::BootLoader::SetupSession
       ~ It took: 1
       ~ Loading: Merb::BootLoader::SetupStubClasses
       ~ It took: 0
       ~ Loading: Merb::BootLoader::AfterAppLoads
       ~ It took: 0
       ~ Loading: Merb::BootLoader::ChooseAdapter
       ~ It took: 0
       ~ Loading: Merb::BootLoader::RackUpApplication
       ~ It took: 0
       ~ Loading: Merb::BootLoader::ReloadClasses
       ~ It took: 0
      DEPRECATION WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library will be REMOVED FROM RAILS 2.2. Please switch to the offical mysql gem: `gem install mysql`  See http://www.rubyonrails.org/deprecation for details. (called from mysql_connection at /Users/arungupta/tools/jruby-1.1.5/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:81)
       ~   SQL (0.000581)   SET NAMES 'utf8'
       ~   SQL (0.000581)   SET SQL_AUTO_IS_NULL=0
       ~   SQL (0.000894)   CREATE DATABASE `hello_development` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_general_ci`
      MySQL hello_development database successfully created
    5. Migrate the database as:

      ~/samples/jruby/merb/hello >rake db:migrate
      (in /Users/arungupta/samples/jruby/merb/hello)
      JRuby limited openssl loaded. gem install jruby-openssl for full support.
      http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
      Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
      Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
      Loading init file from /Users/arungupta/samples/jruby/merb/hello/config/init.rb
      Loading /Users/arungupta/samples/jruby/merb/hello/config/environments/development.rb
       ~ It took: 0
       ~ Loading: Merb::BootLoader::MixinSession
       ~ It took: 0
       ~ Loading: Merb::BootLoader::BeforeAppLoads
       ~ It took: 0
       ~ Loading: Merb::Orms::ActiveRecord::Connect
       ~ Connecting to database...
       ~ It took: 0
       ~ Loading: Merb::BootLoader::LoadClasses
       ~ It took: 1
       ~ Loading: Merb::BootLoader::Router
       ~ Compiling routes...
       ~ It took: 0
       ~ Loading: Merb::BootLoader::Templates
       ~ It took: 0
       ~ Loading: Merb::BootLoader::MimeTypes
       ~ It took: 0
       ~ Loading: Merb::BootLoader::Cookies
       ~ It took: 0
       ~ Loading: Merb::BootLoader::SetupSession
       ~ It took: 0
       ~ Loading: Merb::BootLoader::SetupStubClasses
       ~ It took: 0
       ~ Loading: Merb::BootLoader::AfterAppLoads
       ~ It took: 0
       ~ Loading: Merb::BootLoader::ChooseAdapter
       ~ It took: 0
       ~ Loading: Merb::BootLoader::RackUpApplication
       ~ It took: 0
       ~ Loading: Merb::BootLoader::ReloadClasses
       ~ It took: 0
      DEPRECATION WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library will be REMOVED FROM RAILS 2.2. Please switch to the offical mysql gem: `gem install mysql`  See http://www.rubyonrails.org/deprecation for details. (called from mysql_connection at /Users/arungupta/tools/jruby-1.1.5/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/mysql_adapter.rb:81)
       ~   SQL (0.000769)   SET NAMES 'utf8'
       ~   SQL (0.000610)   SET SQL_AUTO_IS_NULL=0
       ~   SQL (0.001609)   SHOW TABLES
       ~   SQL (0.003952)   CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB
       ~   SQL (0.054355)   CREATE UNIQUE INDEX `unique_schema_migrations` ON `schema_migrations` (`version`)
       ~   SQL (0.001691)   SHOW TABLES
       ~   SQL (0.001643)   SELECT version FROM schema_migrations
       ~ Migrating to RunnerMigration (1)
      == 1 RunnerMigration: migrating ===============================================
      -- create_table(:runners)
       ~   SQL (0.005301)   CREATE TABLE `runners` (`id` int(11) DEFAULT NULL auto_increment PRIMARY KEY, `distance` float, `minutes` int(11), `created_at` datetime, `updated_at` datetime) ENGINE=InnoDB
         -> 0.0107s
      == 1 RunnerMigration: migrated (0.0114s) ======================================

       ~   SQL (0.014063)   INSERT INTO schema_migrations (version) VALUES ('1')
       ~   SQL (0.003585)   SHOW TABLES
       ~   SQL (0.001324)   SELECT version FROM schema_migrations
       ~   SQL (0.001451)   SHOW TABLES
       ~   SQL (0.017054)   SHOW FIELDS FROM `runners`
       ~   SQL (0.018503)   describe `runners`
       ~   SQL (0.009372)   SHOW KEYS FROM `runners`
  4. Create the CRUD views
    1. Add dependencies
      1. Edit "config/init.rb" and add the following line:

        require 'config/dependencies.rb'

        as the first uncommented line.
      2. Create "config/dependencies.rb" and add the following dependency (explained here):

        dependency "merb-assets", "1.0"
        dependency "merb-helpers", "1.0"
    2. Add the resource routes by editing "config/router.rb" and adding:

      resources :runners

      insider "Merb::Router.prepare do" block.
    3. Edit the "index" view in "app/views/runners/index.html.erb" as:

      <h1>Runner controller, index action</h1>

      <table>
        <tr>
          <th>Distance (in miles)</th>
          <th>Time (in mins)</th>

          <th colspan="3">Actions</th>
        </tr>

      <% @runners.each do |runner| %>
        <tr>
          <td><%=h runner.distance %></td>
          <td><%=h runner.minutes %></td>

          <td><%= link_to 'Show', resource(runner) %></td>
          <td><%= link_to 'Edit', resource(runner, :edit) %></td>
          <td><%= delete_button(runner, "Delete #{runner.distance}") %></td>
        </tr>
      <% end %>
      </table>

      <%= link_to 'New', resource(:runners, :new) %>
    4. Edit the "new" in "app/views/runners/new.html.erb" view as:

      <h1>Runners controller, new action</h1>

      <%= form_for(@runner, :action => resource(:runners) ) do %>
       
        <p>
          <%= text_field :distance, :label => "Distance (in miles)" %>
        </p>
       
        <p>
          <%= text_field :minutes, :label => "Time (in mins)"  %>
        </p>
       
        <p>
          <%= submit "Create" %>
        </p>
      <% end =%>
       
      <%= link_to 'Back', resource(:runners) %>
    5. Edit the "show" view in "app/views/runners/show.html.erb" as:

      <h1>Runners controller, show action</h1>

      <p>Distance (in miles): <%=h @runner.distance %></p>
      <p>Time (in mins): <%=h @runner.minutes %></p>
       
      <%= link_to 'Back', resource(:runners) %>
    6. Edit the "edit" in "app/views/runners/edit.html.erb" view as:

      <h1>Runners controller, edit action</h1>

      <%= form_for(@runner, :action => resource(@runner)) do %>
       
        <p>
          <%= text_field :distance, :label => "Distance (in miles)"  %>
        </p>
       
        <p>
          <%= text_field :minutes, :label => "Time (in mins)"  %>
        </p>
       
        <p>
          <%= submit "Update" %>
        </p>
      <% end =%>
       
      <%= link_to 'Show', resource(@runner) %> | <%= link_to 'Back', resource(:runners) %>
That's it!

And now here are some of the captured outputs.

The default output at "http://localhost:3000/runners"



Creating a new Runner at "http://localhost:3000/runners/new" as:



"Show" view of a runner at "http://localhost:3000/runners/<id>" as :



"Index" view with one runner at "http://localhost:3000/runners" as:



And now "index" view with 2 runners at "http://localhost:3000/runners" as:



A Merb app generated using MRI can also be run using GlassFish, provided it does not have any native dependencies.

And another useful piece of information is difference between Rails and Merb provide comparative syntax between Rails and Merb.

And thanks to all the discussion on merb@googlegroups where all my questions were answered very promptly!

Submit your bugs here, talk to us using GlassFish Forum, and get the latest information on JRuby wiki.

Technorati: totd glassfish v3 gem jruby rubyonrails merb

Friday Nov 14, 2008

TOTD #52: Getting Started with Merb using GlassFish Gem

GlassFish Gem 0.9.0 was recently released. It can run any Rack-compatible framework such as Rails and Merb. Support for another Rack-based framework Sinatra will be released in the near future. The gem is even extensible and allows to plug any of your favorite Ruby framework using -apptype switch (more on this in a future blog). This blog shows how to install the gem and use it for running a Merb application.



Lets install the gem first:

~/tools/jruby-1.1.5 >gem install glassfish rack
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed glassfish-0.9.0-universal-java
Successfully installed rack-0.4.0
2 gems installed
Installing ri documentation for glassfish-0.9.0-universal-java...
Installing ri documentation for rack-0.4.0...
Installing RDoc documentation for glassfish-0.9.0-universal-java...
Installing RDoc documentation for rack-0.4.0...

The Rack dependency will be fixed as part of the next gem update and for now we have to install it explicitly. The different options supported by the gem can be seen using "-h" switch as:

~/tools/jruby-1.1.5 >glassfish -h

Synopsis
--------
glassfish: GlassFish v3 server for rails, merb, sintra applications


Usage:
------
glassfish [OPTION] APPLICATION_PATH

-h, --help:             show help

-c, --contextroot PATH: change the context root (default: '/')

-p, --port PORT:        change server port (default: 3000)

-e, --environment ENV:  change rails environment (default: development)

-n --runtimes NUMBER:   Number of JRuby runtimes to crete initially

--runtimes-min NUMBER:  Minimum JRuby runtimes to crete

--runtimes-max NUMBER:  Maximum number of JRuby runtimes to crete

APPLICATION_PATH (optional): Path to the application to be run (default:
current).

And complete rdocs are available here.

Lets create and run a Merb application!
  1. Install Merb: Merb 1.0 has some native dependencies in DataMapper and so cannot be installed as is with JRuby. However since Merb is ORM-agnostic, ActiveRecord can be installed as ORM layer. "gem install merb" uses DataMapper as the default ORM so a Merb installation in JRuby (for now) is:

    ~/tools/jruby-1.1.5 >gem install merb-core merb-more merb_activerecord
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Successfully installed extlib-0.9.8
    Successfully installed abstract-1.0.0
    Successfully installed erubis-2.6.2
    Successfully installed json_pure-1.1.3
    Successfully installed rack-0.4.0
    Successfully installed mime-types-1.15
    Successfully installed thor-0.9.8
    Successfully installed merb-core-1.0
    Successfully installed ZenTest-3.11.0
    Successfully installed RubyInline-3.8.1
    Successfully installed sexp_processor-3.0.0
    Successfully installed ParseTree-3.0.2
    Successfully installed ruby2ruby-1.2.1
    Successfully installed merb-action-args-1.0
    Successfully installed merb-assets-1.0
    Successfully installed merb-slices-1.0
    Successfully installed merb-auth-core-1.0
    Successfully installed merb-auth-more-1.0
    Successfully installed merb-auth-slice-password-1.0
    Successfully installed merb-auth-1.0
    Successfully installed merb-cache-1.0
    Successfully installed merb-exceptions-1.0
    Successfully installed highline-1.5.0
    Successfully installed diff-lcs-1.1.2
    Successfully installed templater-0.4.0
    Successfully installed merb-gen-1.0
    Successfully installed haml-2.0.4
    Successfully installed merb-haml-1.0
    Successfully installed merb-helpers-1.0
    Successfully installed mailfactory-1.4.0
    Successfully installed merb-mailer-1.0
    Successfully installed merb-param-protection-1.0
    Successfully installed addressable-1.0.4
    Successfully installed data_objects-0.9.6
    Successfully installed dm-core-0.9.6
    Successfully installed dm-migrations-0.9.6
    Successfully installed merb_datamapper-1.0
    Successfully installed merb-more-1.0
    Successfully installed merb_activerecord-0.9.13
    39 gems installed
    Installing ri documentation for json_pure-1.1.3...
    Installing ri documentation for rack-0.4.0...
    Installing ri documentation for mime-types-1.15...
    . . .
    Installing RDoc documentation for dm-migrations-0.9.6...
    Installing RDoc documentation for merb_datamapper-1.0...
    Installing RDoc documentation for merb_activerecord-0.9.13...

    It would be nice if this can be further simplified to "gem install merb --orm activerecord" or something similar.
  2. Create a Merb application:  A "jump start" Merb application created using "merb-gen app" uses ERB templating and DataMapper for ORM. But as mentioned earlier DataMapper does not work with JRuby (at least for now) so a Merb application needs to be created using "merb-gen core". This command creates a Merb application with Ruby-on-Rails like structure and allows to plugin templating engine and ORM frameworks.

    Lets create our first Merb application with no ORM and default templating engine as:

    ~/samples/jruby/merb >merb-gen core hello
    Generating with core generator:
         [ADDED]  gems
         [ADDED]  merb.thor
         [ADDED]  .gitignore
         [ADDED]  public/.htaccess
         [ADDED]  doc/rdoc/generators/merb_generator.rb
         [ADDED]  doc/rdoc/generators/template/merb/api_grease.js
         [ADDED]  doc/rdoc/generators/template/merb/index.html.erb
         [ADDED]  doc/rdoc/generators/template/merb/merb.css
         [ADDED]  doc/rdoc/generators/template/merb/merb.rb
         [ADDED]  doc/rdoc/generators/template/merb/merb_doc_styles.css
         [ADDED]  doc/rdoc/generators/template/merb/prototype.js
         [ADDED]  public/favicon.ico
         [ADDED]  public/merb.fcgi
         [ADDED]  public/robots.txt
         [ADDED]  public/images/merb.jpg
         [ADDED]  Rakefile
         [ADDED]  app/controllers/application.rb
         [ADDED]  app/controllers/exceptions.rb
         [ADDED]  app/helpers/global_helpers.rb
         [ADDED]  app/views/exceptions/not_acceptable.html.erb
         [ADDED]  app/views/exceptions/not_found.html.erb
         [ADDED]  autotest/discover.rb
         [ADDED]  autotest/merb.rb
         [ADDED]  autotest/merb_rspec.rb
         [ADDED]  config/init.rb
         [ADDED]  config/rack.rb
         [ADDED]  config/router.rb
         [ADDED]  config/environments/development.rb
         [ADDED]  config/environments/production.rb
         [ADDED]  config/environments/rake.rb
         [ADDED]  config/environments/staging.rb
         [ADDED]  config/environments/test.rb
         [ADDED]  public/javascripts/application.js
         [ADDED]  public/stylesheets/master.css
         [ADDED]  spec
         [ADDED]  app/views/layout/application.html.erb

    ActiveRecord can be used as pluggable ORM by using the command "merb-gen core --orm activerecord hello". A future blog will cover creating a Merb scaffold using ActiveRecord.
  3. Create a new controller as:

    ~/samples/jruby/merb/hello >merb-gen controller Runners
    Loading init file from /Users/arungupta/samples/jruby/merb/jruby-1.1.5/samples/merb/hello/config/init.rb
    Loading /Users/arungupta/samples/jruby/merb/jruby-1.1.5/samples/merb/hello/config/environments/development.rb
    Generating with controller generator:
    Loading init file from /Users/arungupta/samples/jruby/merb/jruby-1.1.5/samples/merb/hello/config/init.rb
    Loading /Users/arungupta/samples/jruby/merb/jruby-1.1.5/samples/merb/hello/config/environments/development.rb
         [ADDED]  app/controllers/runners.rb
         [ADDED]  app/views/runners/index.html.erb
         [ADDED]  spec/requests/runners_spec.rb
         [ADDED]  app/helpers/runners_helper.rb

    Notice the convention of controller name is a plural word and starting with a capital letter.
  4. Edit application
    1. Edit "app/controllers/runners.rb" and change the "index" action such that it looks like:

        def index
          @message = "Miles to go ..."
          render
        end
    2. Edit "app/views/runners/index.html.erb" and add "<br><%= @message %>" as the last line.
  5. Run application:  Running a Merb application using the Gem is pretty straight forward. If JRUBY_HOME/bin is in PATH, just type the command "glassfish" in the application directory and now you are running a Merb application using GlassFish. The application is accessible at "http://localhost:3000" and the output looks like:



    The controller is accessible at "http://localhost:3000/runners" and the output is:

Hit Ctrl+C to stop the application.

A Merb app generated using MRI can also be run using GlassFish, provided it does not have any native dependencies. On my MacBook, I had to update gems (gem update --system) and install XCode.

This same gem can be used to run Rails application, and guess what? That is pretty straight forward too. Just type "glassfish" in the application directory and now you are running a Rails application on GlassFish. These applications can very well be created using MRI but they must be using pure-Ruby gems/plugins. Alternatively Foreign Function Interface can be used to port your native gems to Ruby.

Lets make it more real by running Substruct - an open source E-Commerce project. Install it as explained here, type "glassfish" in the application directory and your application is now accessible at "http://localhost:3000" as shown below:



Really simple, easy and powerful!

Rails powered by GlassFish
explains the benefits of running Rails application on GlassFish. And now GlassFish v3 Prelude allows you to even buy production support for your Rails applications! Screencast #26 how to develop/run/debug your Rails application using NetBeans and GlassFish.

Open Source Rails has a gallery of open source Rails projects, have you tried any of them ?

Is there any Merb equivalent of www.opensourcerails.com ?

Technorati: totd glassfish v3 gem rubyonrails merb rack

Monday Jul 21, 2008

JRuby 1.1.3 released - Getting Started with GlassFish


JRuby 1.1.3 was released last week - download here. The highlights are:
  • 82 issues resolved since JRUby 1.1.2
  • RubyGem 1.2 (phew, finally Gem installation is much faster again :)
  • Bunch of Compatibility and Performance problems
Going forward, JRuby point releases will be on a 3-4 week frequency. And you can always checkout the trunk and build yourself.

Here are few simple steps to get you started:
  1. Download and unzip the distribution.
  2. Install Rails and GlassFish gem:

    ~/testbed/jruby-1.1.3 >./bin/jruby -S gem install rails glassfish --no-ri --no-rdoc
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Successfully installed activesupport-2.1.0
    Successfully installed activerecord-2.1.0
    Successfully installed actionpack-2.1.0
    Successfully installed actionmailer-2.1.0
    Successfully installed activeresource-2.1.0
    Successfully installed rails-2.1.0
    Successfully installed glassfish-0.3.1-universal-java
    7 gems installed
  3. Create a new Rails app as:

    ~/testbed/jruby-1.1.3/samples/rails >../../bin/jruby -S rails helloworld -d mysql 
          create 
          create  app/controllers
          create  app/helpers
          create  app/models
          create  app/views/layouts
          create  config/environments
          create  config/initializers
          create  db
          create  doc
    . . .
          create  log/server.log
          create  log/production.log
          create  log/development.log
          create  log/test.log
  4. Run Rails application on GlassFish gem as:

    ~/testbed/jruby-1.1.3/samples/rails >../../bin/jruby -S glassfish_rails helloworld
    Jul 21, 2008 8:32:03 AM com.sun.enterprise.glassfish.bootstrap.ASMain main
    INFO: Launching GlassFish on HK2 platform
    Jul 21, 2008 8:32:03 AM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient
    INFO: Cannot find javadb client jar file, jdbc driver not available
    Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3000
    Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
    WARNING: pewebcontainer.all_ssl_protocols_disabled
    Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
    WARNING: pewebcontainer.all_ssl_ciphers_disabled
    Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3131
    Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3838
    Jul 21, 2008 8:32:04 AM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
    INFO: Admin Console Adapter: context root: /admin
    Jul 21, 2008 8:32:05 AM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool
    INFO: Starting Rails instances
    Jul 21, 2008 8:32:09 AM 
    SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Jul 21, 2008 8:32:10 AM com.sun.grizzly.jruby.RubyObjectPool$1 run
    INFO: JRuby and Rails instance instantiation took : 5623ms
    Jul 21, 2008 8:32:10 AM org.glassfish.scripting.rails.RailsDeployer load
    INFO: Loading application helloworld at /
    Jul 21, 2008 8:32:10 AM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 7046 ms
  5. Create a scaffold as:

  6. ~/testbed/jruby-1.1.3/samples/rails/helloworld >../../../bin/jruby script/generate scaffold runner distance:float minutes:integer
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
          exists  app/models/
          exists  app/controllers/
          exists  app/helpers/
          create  app/views/runners
          exists  app/views/layouts/
          exists  test/functional/
          exists  test/unit/
          exists  public/stylesheets/
          create  app/views/runners/index.html.erb
          create  app/views/runners/show.html.erb
          create  app/views/runners/new.html.erb
          create  app/views/runners/edit.html.erb
          create  app/views/layouts/runners.html.erb
          create  public/stylesheets/scaffold.css
          create  app/controllers/runners_controller.rb
          create  test/functional/runners_controller_test.rb
          create  app/helpers/runners_helper.rb
           route  map.resources :runners
      dependency  model
          exists    app/models/
          exists    test/unit/
          exists    test/fixtures/
          create    app/models/runner.rb
          create    test/unit/runner_test.rb
          create    test/fixtures/runners.yml
          create    db/migrate
          create    db/migrate/20080721153737_create_runners.rb
  7. Start MySQL database, create and migrate the database:

    ~/testbed/jruby-1.1.3/samples/rails/helloworld >../../../bin/jruby -S rake db:create
    (in /Users/arungupta/testbed/jruby-1.1.3/samples/rails/helloworld)
    ~/testbed/jruby-1.1.3/samples/rails/helloworld >../../../bin/jruby -S rake db:migrate
    (in /Users/arungupta/testbed/jruby-1.1.3/samples/rails/helloworld)
    == 20080721154435 CreateRunners: migrating ====================================
    -- create_table(:runners)
       -> 0.0097s
    == 20080721154435 CreateRunners: migrated (0.0104s) ===========================

    Now "http://localhost:3000/runners" page is shown as:



    After adding couple of entries, the page looks like:



    Now, let's try to run the same application on GlassFish v3 stand-alone build.

    TOTD #33 explains how to build GlassFish v3 workspace. Alternatively nightly or promoted builds can be downloaded as well.

  8. Start the v3 server as:

    ~/testbed/glassfish/v3/snapshot/glassfish >java -DJRUBY_HOME=/Users/arungupta/testbed/jruby-1.1.3 -jar modules/glassfish-10.0-SNAPSHOT.jar
    Jul 21, 2008 9:40:41 AM com.sun.enterprise.glassfish.bootstrap.ASMain main
    INFO: Launching GlassFish on Apache Felix OSGi platform
    Jul 21, 2008 9:40:41 AM com.sun.enterprise.glassfish.bootstrap.ASMainOSGi getSharedRepos
    INFO: /Users/arungupta/testbed/glassfish/v3/snapshot/glassfish/domains/domain1/lib does not exist

    Welcome to Felix.
    =================

    . . .

    INFO: Started bundle org.glassfish.common.container-common [91]
    Jul 21, 2008 9:47:13 AM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
    INFO: Admin Console Adapter: context root: /admin
    Jul 21, 2008 9:47:13 AM OSGiModuleImpl loadClass
    INFO: Started bundle org.glassfish.deployment.deployment-common [71]
    Jul 21, 2008 9:47:13 AM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 1507 ms
  9. Deploy the application as:

    ~/testbed/jruby-1.1.3/samples/rails >~/testbed/glassfish/v3/snapshot/glassfish/bin/asadmin deploy helloworld

    Command deploy executed successfully.

    and the GlassFish console shows the following output:

    Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass
    INFO: Started bundle org.glassfish.web.war-util [65]
    Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass
    INFO: Started bundle org.glassfish.persistence.jpa-connector [25]
    Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass
    INFO: Started bundle org.glassfish.scripting.gf-jruby-connector [13]
    Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass
    INFO: Started bundle org.glassfish.core.security [22]
    Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass
    INFO: Started bundle org.glassfish.web.gf-web-connector [86]
    Jul 21, 2008 9:47:49 AM OSGiModuleImpl loadClass
    INFO: Started bundle org.glassfish.connectors.gf-connectors-connector [53]
    Jul 21, 2008 9:47:49 AM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool
    INFO: Starting Rails instances
    Jul 21, 2008 9:48:01 AM 
    SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Jul 21, 2008 9:48:02 AM com.sun.grizzly.jruby.RubyObjectPool$1 run
    INFO: JRuby and Rails instance instantiation took : 12852ms
    Jul 21, 2008 9:48:02 AM org.glassfish.scripting.rails.RailsDeployer load
    INFO: Loading application helloworld at /helloworld
    Jul 21, 2008 9:48:02 AM com.sun.enterprise.v3.deployment.DeployCommand execute
    INFO: Deployment of helloworld done is 13326 ms

  10. The deployed application at "http://localhost:8080/helloworld/runners" looks like:



Rails powered by the GlassFish Application Server explain in detail about the several benefits of using GlassFish for Rails development and deployment. Rails/GlassFish Deployment Stories gives a good idea of how to structure your own application.

Are you using GlassFish for development or deployment of Rails ? Drop a comment on this blog.

Technorati: rubyonrails jruby ruby glassfish v3 gem

Tuesday Jul 01, 2008

TOTD #37: SQLite3 with Ruby-on-Rails on GlassFish Gem


The default database for Rails 2.0.x application is SQLite3. This database is bundled with Mac OSX Leopard and so makes it really easy to get started with Ruby-on-Rails. But it requires couple of additional steps if you are using JRuby.


TOTD #28 explains how to create a simple CRUD application using Rails 2.0.x. It uses MySQL database which is strongly recommended for deployment. This TOTD (Tip Of The Day) provides complete steps to run a Ruby-on-Rails application using JRuby and GlassFish Gem with the default database, i.e. SQLite3.
  1. Create a Rails application as:

    ~/samples/jruby >~/testbed/jruby-1.1.2/bin/jruby -S rails runner
          create 
          create  app/controllers
          create  app/helpers
          create  app/models
          create  app/views/layouts
    . . .
          create  log/server.log
          create  log/production.log
          create  log/development.log
          create  log/test.log

    The generated "database.yml" looks like:

    # SQLite version 3.x
    #   gem install sqlite3-ruby (not necessary on OS X Leopard)
    development:
      adapter: sqlite3
      database: db/development.sqlite3
      timeout: 5000

    # Warning: The database defined as "test" will be erased and
    # re-generated from your development database when you run "rake".
    # Do not set this db to the same as development or production.
    test:
      adapter: sqlite3
      database: db/test.sqlite3
      timeout: 5000

    production:
      adapter: sqlite3
      database: db/production.sqlite3
      timeout: 5000
  2. SQLite3 adapter is installed for the native Ruby bundled with Leopard. But in order to use SQLite3 with JRuby, you need to install SQLite3 JDBC adapter as shown below:

    ~/samples/jruby/runner >~/testbed/jruby-1.1.2/bin/jruby -S gem install activerecord-jdbcsqlite3-adapter
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Successfully installed activerecord-jdbc-adapter-0.8.2
    Successfully installed jdbc-sqlite3-3.5.8
    Successfully installed activerecord-jdbcsqlite3-adapter-0.8.2
    3 gems installed
    Installing ri documentation for activerecord-jdbc-adapter-0.8.2...
    Installing ri documentation for jdbc-sqlite3-3.5.8...
    Installing ri documentation for activerecord-jdbcsqlite3-adapter-0.8.2...
    Installing RDoc documentation for activerecord-jdbc-adapter-0.8.2...
    Installing RDoc documentation for jdbc-sqlite3-3.5.8...
    Installing RDoc documentation for activerecord-jdbcsqlite3-adapter-0.8.2...
  3. Create a new file as "db/development.sqlite3". It can be easily created using the "touch" command. See the beauty of SQLite that "db:create" is not required :)
  4. Update the development section of "database.yml" such that it looks like:

    development:
      adapter: jdbcsqlite3
      database: db/development.sqlite3
      timeout: 5000
  5. Create a simple scaffold as shown below:

    ~/samples/jruby/runner >~/testbed/jruby-1.1.2/bin/jruby script/generate scaffold run distance:float minutes:integer
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
          exists  app/models/
          exists  app/controllers/
          exists  app/helpers/
          create  app/views/runs
          exists  app/views/layouts/
          exists  test/functional/
          exists  test/unit/
          exists  public/stylesheets/
          create  app/views/runs/index.html.erb
          create  app/views/runs/show.html.erb
          create  app/views/runs/new.html.erb
          create  app/views/runs/edit.html.erb
          create  app/views/layouts/runs.html.erb
          create  public/stylesheets/scaffold.css
          create  app/controllers/runs_controller.rb
          create  test/functional/runs_controller_test.rb
          create  app/helpers/runs_helper.rb
           route  map.resources :runs
      dependency  model
          exists    app/models/
          exists    test/unit/
          exists    test/fixtures/
          create    app/models/run.rb
          create    test/unit/run_test.rb
          create    test/fixtures/runs.yml
          create    db/migrate
          create    db/migrate/20080630211244_create_runs.rb

    and run the migration as

    ~/samples/jruby/runner >~/testbed/jruby-1.1.2/bin/jruby -S rake db:migrate
    (in /Users/arungupta/samples/jruby/runner)
    == 20080630205502 CreateRuns: migrating =======================================
    -- create_table(:runs)
       -> 0.0410s
       -> 0 rows
    == 20080630205502 CreateRuns: migrated (0.0420s) ==============================
  6. A Rails application is deployed on GlassFish from it's parent directory. Therefore the application needs to be updated so taht exact location of database is specified. Basically you need to edit "database.yml" and the updated "development" fragment looks like:

    development:
      adapter: jdbcsqlite3
      database: runner/db/development.sqlite3
      timeout: 5000
  7. Run the application on GlassFish v3 gem as:

    ~/samples/jruby >~/testbed/jruby-1.1.2/bin/jruby -S glassfish_rails runner
    Jun 30, 2008 1:52:08 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
    INFO: Launching GlassFish on HK2 platform
    Jun 30, 2008 1:52:08 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient
    INFO: Cannot find javadb client jar file, jdbc driver not available
    Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3000
    Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
    WARNING: pewebcontainer.all_ssl_protocols_disabled
    Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
    WARNING: pewebcontainer.all_ssl_ciphers_disabled
    Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3131
    Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3838
    Jun 30, 2008 1:52:09 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
    INFO: Admin Console Adapter: context root: /admin
    Jun 30, 2008 1:52:09 PM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool
    INFO: Starting Rails instances
    Jun 30, 2008 1:52:16 PM  
    SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Jun 30, 2008 1:52:17 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
    INFO: JRuby and Rails instance instantiation took : 7998ms
    Jun 30, 2008 1:52:17 PM org.glassfish.scripting.rails.RailsDeployer load
    INFO: Loading application runner at /
    Jun 30, 2008 1:52:17 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 9430 ms

After adding couple of entries, "http://localhost:3000/runs" looks like:



So now you can use SQLite3 as your development database for Rails applications running on GlassFish v3 Gem.

Here are some useful pointers:

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive is available here.


Technorati: totd rubyonrails jruby ruby sqlite sqlite3 glassfish v3 gem

Tuesday Jun 24, 2008

Rails GlassFish Gem 0.3.1 now available

Vivek released 0.3.0 version of GlassFish Gem for Rails (a total of 11 issues fixed and resolved - RubyForge & GlassFish Issue Tracker) earlier. But that caused a regression on #4228. And so matching the agility expected by Rails developers, he quickly released 0.3.1. And a wee bit smaller too - 2.68MB for 0.3.1 instead of 2.69MB for 0.3.0.

If you have an existing version of the gem, then you just need to update it:

~/testbed/jruby-1.1 >bin/jruby -S gem update glassfish -r
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Updating installed gems...
Bulk updating Gem source index for: http://gems.rubyforge.org
Attempting remote update of glassfish
Successfully installed glassfish-0.3.1-universal-java
1 gem installed
Gems updated: glassfish

If the gem has never been installed, then you install it as:

~/testbed/jruby-1.1.2 >bin/jruby -S gem install glassfish
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed glassfish-0.3.1-universal-java
1 gem installed

And make sure next time you have to update the gem instead of installing from scratch ;) For that, just install the gem this time and let us know your feedback on GlassFish Webtier Forum or Webtier Alias. If any of your Rails application do not work then please file bugs at GlassFish Issue Tracker ("V3" as "Found in Version:" and "jruby" as "Subcomponent:").

The gem installation may require to set "JAVA_MEM=-Xmx800m" because of the growing memory requirements. Otherwise you may get "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space".

Try a simple scaffold application to see the output as shown below:


The startup output in the gem console (output from GlassFish) is:

~/testbed/jruby-1.1.2/samples/rails >../../bin/jruby -S glassfish_rails runner
Jun 24, 2008 11:04:51 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on HK2 platform
Jun 24, 2008 11:04:51 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient
INFO: Cannot find javadb client jar file, jdbc driver not available
Jun 24, 2008 11:04:52 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3000
Jun 24, 2008 11:04:52 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
WARNING: pewebcontainer.all_ssl_protocols_disabled
Jun 24, 2008 11:04:52 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
WARNING: pewebcontainer.all_ssl_ciphers_disabled
Jun 24, 2008 11:04:52 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3131
Jun 24, 2008 11:04:52 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3838
Jun 24, 2008 11:04:52 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
INFO: Admin Console Adapter: context root: /admin
Jun 24, 2008 11:04:52 PM com.sun.grizzly.jruby.RailsAdapter startRubyRuntimePool
INFO: Starting Rails instances
Jun 24, 2008 11:04:58 PM 
SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Jun 24, 2008 11:04:59 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
INFO: JRuby and Rails instance instantiation took : 6600ms
Jun 24, 2008 11:04:59 PM org.glassfish.scripting.rails.RailsDeployer load
INFO: Loading application runner at /
Jun 24, 2008 11:04:59 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 7945 ms

and then the console is updated as more entries are added (output from Rails):

Jun 24, 2008 11:05:25 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:

Processing DistancesController#index (for 0:0:0:0:0:0:0:1%0 at 2008-06-24 23:05:25) [GET]

Jun 24, 2008 11:05:25 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Session ID: BAh7ByIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
SGFzaHsABjoKQHVzZWR7ADoMY3NyZl9pZCIlNTdhMGYxNjkxOTk5ZjI1ZjI4
OGZjODZjZjcxN2QyNzQ=--cbf4578767e5887d4b62bd249e7624dcb7d1cf90

Jun 24, 2008 11:05:25 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Parameters: {"controller"=>"distances", "action"=>"index"}

Jun 24, 2008 11:05:25 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library is not suited for production. Please install the C-based MySQL library instead (gem install mysql).

Jun 24, 2008 11:05:25 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   SQL (0.001000)   SET NAMES 'utf8'

Jun 24, 2008 11:05:25 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   SQL (0.001000)   SET SQL_AUTO_IS_NULL=0

Jun 24, 2008 11:05:25 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Distance Load (0.003000)   SELECT \* FROM `distances`

Jun 24, 2008 11:05:25 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: Rendering template within layouts/distances

. . .

Jun 24, 2008 11:05:48 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Parameters: {"authenticity_token"=>"519436f2248515d901051acafe0726dfd88746f0", "distance"=>{"miles"=>"4", "run_at(1i)"=>"2008", "run_at(2i)"=>"6", "run_at(3i)"=>"24", "run_at(4i)"=>"07", "run_at(5i)"=>"00"}, "commit"=>"Create", "controller"=>"distances", "action"=>"create"}

Jun 24, 2008 11:05:48 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Distance Columns (0.009000)   SHOW FIELDS FROM `distances`

Jun 24, 2008 11:05:48 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   SQL (0.000000)   BEGIN

Jun 24, 2008 11:05:48 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Distance Create (0.000000)   INSERT INTO `distances` (`miles`, `run_at`, `created_at`, `updated_at`) VALUES(4.0, '2008-06-24 14:00:00', '2008-06-25 06:05:48', '2008-06-25 06:05:48')

Jun 24, 2008 11:05:48 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   SQL (0.002000)   COMMIT

. . .

Jun 24, 2008 11:06:09 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Parameters: {"authenticity_token"=>"519436f2248515d901051acafe0726dfd88746f0", "distance"=>{"miles"=>"3.5", "run_at(1i)"=>"2008", "run_at(2i)"=>"6", "run_at(3i)"=>"23", "run_at(4i)"=>"06", "run_at(5i)"=>"55"}, "commit"=>"Create", "controller"=>"distances", "action"=>"create"}

Jun 24, 2008 11:06:09 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Distance Columns (0.015000)   SHOW FIELDS FROM `distances`

Jun 24, 2008 11:06:09 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   SQL (0.000000)   BEGIN

Jun 24, 2008 11:06:09 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Distance Create (0.000000)   INSERT INTO `distances` (`miles`, `run_at`, `created_at`, `updated_at`) VALUES(3.5, '2008-06-23 13:55:00', '2008-06-25 06:06:09', '2008-06-25 06:06:09')

Jun 24, 2008 11:06:09 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   SQL (0.001000)   COMMIT

Jun 24, 2008 11:06:09 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: Redirected to http://localhost:3000/distances/5

. . .

Jun 24, 2008 11:06:10 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Parameters: {"controller"=>"distances", "action"=>"index"}

Jun 24, 2008 11:06:10 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Distance Load (0.003000)   SELECT \* FROM `distances`

Jun 24, 2008 11:06:10 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: Rendering template within layouts/distances

Jun 24, 2008 11:06:10 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: Rendering distances/index

Jun 24, 2008 11:06:10 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO:   Distance Columns (0.008000)   SHOW FIELDS FROM `distances`

Jun 24, 2008 11:06:11 PM com.sun.grizzly.jruby.RailsAdapter$Logger log
INFO: Completed in 0.05900 (16 reqs/sec) | Rendering: 0.03200 (54%) | DB: 0.01100 (18%) | 200 OK [http://localhost/distances]

Redmine seems to have issues with Rails 2.1. I'll play with some other applications later. But have you tried deploying your Rails application on GlassFish gem ? As mentioned above, let us know your feedback on GlassFish Webtier Forum or Webtier Alias and file bugs on GlassFish Issue Tracker.

Details about previous versions are available at 0.2.0, 0.1.2, 0.1.1, 0.1.0.

Technorati: glassfish v3 rubyonrails jruby ruby gem

Wednesday Jun 18, 2008

Rails 2.1 on GlassFish - it works!


Rails 2.1 was released earlier this month. GlassFish provides a complete development/deployment environment for Rails applications. Some of the main reasons for using GlassFish (instead of WEBrick or Mongrel) are:
  • Identical Development and Deployment environment
  • Multiple Applications can be deployed on one Container
  • Multiple requests can be handled by a single application (with no extra configuration)
  • Out-of-the-box Clustering, Load Balancing and High Availability
  • Database connection pooling
  • Co-hosting Rails and Java EE applications
More details are available in Rails powered by the GlassFish Application Server. This blog provides detailed instructions to get started with Rails 2.1 on GlassFish.
  1. Install Rails 2.1 in a JRuby 1.1.2 installation:

    ~/testbed/rails21/jruby-1.1.2 >bin/jruby -S gem install rails --no-ri --no-rdoc
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Updating metadata for 253 gems from http://gems.rubyforge.org/
    ...............................................................................
    ...............................................................................
    ...............................................................................
    ................
    complete
    Bulk updating Gem source index for: http://gems.rubyforge.org/
    Successfully installed activesupport-2.1.0
    Successfully installed activerecord-2.1.0
    Successfully installed actionpack-2.1.0
    Successfully installed actionmailer-2.1.0
    Successfully installed activeresource-2.1.0
    Successfully installed rails-2.1.0
    6 gems installed
  2. Create a new Rails app as:

    ~/testbed/rails21/jruby-1.1.2/samples/rails >../../bin/jruby -S rails -d mysql runner
          create  
          create  app/controllers
          create  app/helpers
          create  app/models
          create  app/views/layouts
          create  config/environments
          create  config/initializers
          create  db
          create  doc
          create  lib
          create  lib/tasks
          create  log
          create  public/images
          create  public/javascripts
          create  public/stylesheets
          create  script/performance
          create  script/process
          create  test/fixtures
          create  test/functional
          create  test/integration
          create  test/unit
          create  vendor
          create  vendor/plugins
          create  tmp/sessions
          create  tmp/sockets
          create  tmp/cache
          create  tmp/pids
          create  Rakefile
          create  README
          create  app/controllers/application.rb
          create  app/helpers/application_helper.rb
          create  test/test_helper.rb
          create  config/database.yml
          create  config/routes.rb
          create  config/initializers/inflections.rb
          create  config/initializers/mime_types.rb
          create  config/initializers/new_rails_defaults.rb
          create  config/boot.rb
          create  config/environment.rb
          create  config/environments/production.rb
          create  config/environments/development.rb
          create  config/environments/test.rb
          create  script/about
          create  script/console
          create  script/dbconsole
          create  script/destroy
          create  script/generate
          create  script/performance/benchmarker
          create  script/performance/profiler
          create  script/performance/request
          create  script/process/reaper
          create  script/process/spawner
          create  script/process/inspector
          create  script/runner
          create  script/server
          create  script/plugin
          create  public/dispatch.rb
          create  public/dispatch.cgi
          create  public/dispatch.fcgi
          create  public/404.html
          create  public/422.html
          create  public/500.html
          create  public/index.html
          create  public/favicon.ico
          create  public/robots.txt
          create  public/images/rails.png
          create  public/javascripts/prototype.js
          create  public/javascripts/effects.js
          create  public/javascripts/dragdrop.js
          create  public/javascripts/controls.js
          create  public/javascripts/application.js
          create  doc/README_FOR_APP
          create  log/server.log
          create  log/production.log
          create  log/development.log
          create  log/test.log
  3. Start GlassFish as:

    ~/testbed/glassfish/v3/tp2/glassfishv3-tp2/glassfish >java -DJRUBY_HOME=/Users/arungupta/testbed/rails21/jruby-1.1.2 -jar modules/glassfish-10.0-tp-2-SNAPSHOT.jar
    Jun 17, 2008 6:14:21 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
    INFO: Launching GlassFish on HK2 platform
    Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 8080
    Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 8181
    Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 4848
    Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
    INFO: Admin Console Adapter: context root: /admin
    Jun 17, 2008 6:14:22 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 974 ms
  4. Deploy the newly created application as:

    ~/testbed/rails21/jruby-1.1.2/samples/rails >~/testbed/glassfish/v3/tp2/glassfishv3-tp2/glassfish/bin/asadmin deploy runner
    Command deploy executed successfully.

    and the GlassFish console shows:

    Jun 17, 2008 6:14:41 PM com.sun.enterprise.rails.RailsDeployer registerAdapter
    INFO: Loading application runner at /runner
    Jun 17, 2008 6:14:41 PM  
    INFO: Starting Rails instances
    Jun 17, 2008 6:14:49 PM  
    SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Jun 17, 2008 6:14:51 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
    INFO: Rails instance instantiation took : 9066ms
    Jun 17, 2008 6:14:51 PM com.sun.enterprise.v3.deployment.DeployCommand execute
    INFO: Deployment of runner done is 9168 ms

    The default page at "http://localhost:8080/runner" shows


  5. Generate a Scaffold as described in TOTD #28

    ~/testbed/rails21/jruby-1.1.2/samples/rails/runner >../../../bin/jruby -S rake db:create
    (in /Users/arungupta/testbed/rails21/jruby-1.1.2/samples/rails/runner)
    ~/testbed/rails21/jruby-1.1.2/samples/rails/runner >../../../bin/jruby script/generate scaffold distance miles:float run_at:datetime
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
          exists  app/models/
          exists  app/controllers/
          exists  app/helpers/
          create  app/views/distances
          exists  app/views/layouts/
          exists  test/functional/
          exists  test/unit/
          exists  public/stylesheets/
          create  app/views/distances/index.html.erb
          create  app/views/distances/show.html.erb
          create  app/views/distances/new.html.erb
          create  app/views/distances/edit.html.erb
          create  app/views/layouts/distances.html.erb
          create  public/stylesheets/scaffold.css
          create  app/controllers/distances_controller.rb
          create  test/functional/distances_controller_test.rb
          create  app/helpers/distances_helper.rb
           route  map.resources :distances
      dependency  model
          exists    app/models/
          exists    test/unit/
          exists    test/fixtures/
          create    app/models/distance.rb
          create    test/unit/distance_test.rb
          create    test/fixtures/distances.yml
          create    db/migrate
          create    db/migrate/20080618012326_create_distances.rb
    ~/testbed/rails21/jruby-1.1.2/samples/rails/runner >../../../bin/jruby -S rake db:migrate
    (in /Users/arungupta/testbed/rails21/jruby-1.1.2/samples/rails/runner)
    == 20080618012326 CreateDistances: migrating ==================================
    -- create_table(:distances)
       -> 0.0080s
    == 20080618012326 CreateDistances: migrated (0.0090s) =========================
  6. Edit line 44 of "config/environment.rb" to change the default timezone from "UTC" to "Pacific Time (US & Canada)". The updated line looks like:

      config.time_zone = 'Pacific Time (US & Canada)'
  7. Creating a new scaffold entry shows the following screen:



    Notice how default timezone is selected using Rails 2.1 Time Zone Support. After creating couple of entries (as described in TOTD #28), the page at "http://localhost:8080/runner/distances" looks like:



    Notice how "-0700" is shown which is the offset for US Pacific Time during daylight savings.

The same application can also be easily deployed on GlassFish v3 Gem. Let's see how:
  1. Install GlassFish v3 Gem as:

    ~/testbed/rails21/jruby-1.1.2 >bin/jruby -S gem install glassfish
    JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Updating metadata for 13 gems from http://gems.rubyforge.org/
    .............
    complete
    Successfully installed glassfish-0.2.0-universal-java
    1 gem installed
  2. Deploy the previously created Rails application as:

    ~/testbed/rails21/jruby-1.1.2/samples/rails >../../bin/jruby -S glassfish_rails runner
    Jun 17, 2008 6:39:37 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
    INFO: Launching GlassFish on HK2 platform
    Jun 17, 2008 6:39:37 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient
    INFO: Cannot find javadb client jar file, jdbc driver not available
    Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3000
    Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
    WARNING: pewebcontainer.all_ssl_protocols_disabled
    Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
    WARNING: pewebcontainer.all_ssl_ciphers_disabled
    Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3131
    Jun 17, 2008 6:39:38 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
    INFO: Listening on port 3838
    Jun 17, 2008 6:39:39 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
    INFO: Admin Console Adapter: context root: /admin
    Jun 17, 2008 6:39:39 PM com.sun.enterprise.rails.RailsDeployer registerAdapter
    INFO: Loading application runner at /
    Jun 17, 2008 6:39:39 PM 
    INFO: Starting Rails instances
    Jun 17, 2008 6:39:44 PM 
    SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
    http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
    Jun 17, 2008 6:39:45 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
    INFO: Rails instance instantiation took : 6710ms
    Jun 17, 2008 6:39:45 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 8053 ms

    The page at "http://localhost:3000/runner" looks like:



Let us know on GlassFish Webtier Forum or Webtier Alias if you tried any of your Rails application on GlassFish. Please file bugs at GlassFish Issue Tracker ("V3" as "Found in Version:" and "jruby" as "Subcomponent:") if your app is not working.

Technorati: glassfish v3 rubyonrails jruby ruby gem

Wednesday May 28, 2008

JRuby 1.1.2 released - Getting Started with v3 Gem


JRuby 1.1.2 was released yesterday - download here!

The highlights are:
  • Startup time drastically reduced
  • YAML symbol parsing >100x faster
  • Performance, threading, and stack depth improvements for method calls
  • Fixed several nested backref problems
  • Fixed bad data race (JRUBY-2483)
  • Gazillions of bigdecimal issues fixed
  • 95 issues resolved since JRuby 1.1.1
Getting started is really simple, just follow the steps listed below.

Unzip JRuby 1.1.2 zip bundle ...

~/testbed/ >unzip ~/Downloads/jruby-bin-1.1.2.zip
Archive:  /Users/arungupta/Downloads/jruby-bin-1.1.2.zip
   creating: jruby-1.1.2/
   creating: jruby-1.1.2/bin/
  inflating: jruby-1.1.2/bin/_jrubycleanup.bat 
  inflating: jruby-1.1.2/bin/_jrubyvars.bat 
  . . .
  inflating: jruby-1.1.2/share/ri/1.8/system/Zlib/crc_table-c.yaml 
  inflating: jruby-1.1.2/share/ri/1.8/system/Zlib/zlib_version-c.yaml 
  inflating: jruby-1.1.2/share/ri/1.8/system/created.rid 
  inflating: jruby-1.1.2/share/ri/1.8/system/fatal/cdesc-fatal.yaml 
~/testbed >

... and then install Rails and GlassFish v3 gem ...

~/testbed/jruby-1.1.2 >bin/jruby -S gem install rails glassfish --no-ri --no-rdoc
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Bulk updating Gem source index for: http://gems.rubyforge.org/
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed activesupport-2.0.2
Successfully installed activerecord-2.0.2
Successfully installed actionpack-2.0.2
Successfully installed actionmailer-2.0.2
Successfully installed activeresource-2.0.2
Successfully installed rails-2.0.2
Successfully installed glassfish-0.2.0-universal-java
6 gems installed

... and verify ...

~/testbed/jruby-1.1.2 >bin/jruby -S gem list g

\*\*\* LOCAL GEMS \*\*\*

glassfish (0.2.0)

... and now host any of your Rails application on v3 Gem (such as Redmine) ...

~/testbed/redmine >../jruby-1.1.2/bin/jruby -S glassfish_rails redmine-0.7
May 28, 2008 12:07:19 PM com.sun.enterprise.glassfish.bootstrap.ASMain main
INFO: Launching GlassFish on HK2 platform
May 28, 2008 12:07:19 PM com.sun.enterprise.glassfish.bootstrap.ASMainHK2 findDerbyClient
INFO: Cannot find javadb client jar file, jdbc driver not available
May 28, 2008 12:07:20 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3000
May 28, 2008 12:07:20 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
WARNING: pewebcontainer.all_ssl_protocols_disabled
May 28, 2008 12:07:20 PM com.sun.enterprise.v3.services.impl.GrizzlyEmbeddedHttpConfigurator configureSSL
WARNING: pewebcontainer.all_ssl_ciphers_disabled
May 28, 2008 12:07:20 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3131
May 28, 2008 12:07:20 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start
INFO: Listening on port 3838
May 28, 2008 12:07:21 PM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setContextRoot
INFO: Admin Console Adapter: context root: /admin
May 28, 2008 12:07:21 PM com.sun.enterprise.rails.RailsDeployer registerAdapter
INFO: Loading application redmine-0.7 at /
May 28, 2008 12:07:21 PM 
INFO: Starting Rails instances
May 28, 2008 12:07:26 PM 
SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
May 28, 2008 12:07:32 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
INFO: Rails instance instantiation took : 11481ms
May 28, 2008 12:07:32 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 12787 ms

Below is the screenshot from a previously deployed Redmine application, now on the GlassFish gem:



Simple isn't it ?

If your Rails application does not work on the gem, file bugs here with "jruby" as "subcomponent" (default version is "v3").

Alternatively, you can download GlassFish v3 TP2 and deploy your applications to leverage complete Java EE functionality.

You can also configure JRuby 1.1.2 as a Ruby platform in NetBeans 6.1 as described in TOTD #27.

Technorati: jruby ruby rubyonrails glassfish v3 gem redmine netbeans webtier

Sunday May 04, 2008

GlassFish v3 Gem 0.2.0 released


A newer version of GlassFish v3 Gem for Ruby on Rails is now available.

What's new ?
  • Codebase aligned with GlassFish v3 Technology Preview 2
  • Previous version (0.1.2) had some packaging issues which increased the size but now it's back to sweet 2.8 Mb.
Check if previously installed by using the following command:

~/testbed/jruby-1.1.1 >bin/jruby -S gem list glassfish

\*\*\* LOCAL GEMS \*\*\*

glassfish (0.1.2)

If already installed (as indicated by the list of gems) then uinstall it using the following command:

~/testbed/jruby-1.1.1 >bin/jruby -S gem uninstall glassfish
Successfully uninstalled glassfish-0.1.2-universal-java
Remove executables:
        glassfish_rails, asadmin, asadmin.bat

in addition to the gem? [Yn]  y
Removing glassfish_rails
Removing asadmin
Removing asadmin.bat

And then install it again as:

~/testbed/jruby-1.1.1 >bin/jruby -S gem install glassfish
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed glassfish-0.2.0-universal-java
1 gem installed

Updating the gem is giving unpredictable results (mostly not updating) and will be investigated later.

Rails powered by the GlassFish Application Server explains why GlassFish is a better deployment option for Rails applications.

All the latest information about the gem can be found at GlassFish JRuby wiki or JRuby wiki.

Please use the gem and send us feedback on GlassFish forums, dev@glassfish or gem mailing list.

Technorati: rubyonrails jruby ruby glassfish v3 gem

Tuesday Apr 08, 2008

JRuby 1.1 released - ready for production!

JRuby 1.1 is released and ready for production use today. You can unleash the potential in 3 simple steps - download, unzip & get started. Here is a quote from the announcement:

more and more reports of applications exceeding Ruby 1.8.6 performance; we are even beating Ruby 1.9 in some microbenchmarks

This is validated by 1 (Oct 2007), 2 (Nov 2007), 3 (Feb 2008), 4 (Feb 2008) and many other hidden/unknown reports. You can easily configure JRuby 1.1 as the platform of your choice in NetBeans 6.1 as described in TOTD #27.

Now, match this blazing performance of JRuby with GlassFish v3 gem (only 2.4 Mb) which provides a superior solution for developing and deploying Rails application. The main reasons for using GlassFish instead of WEBrick/Mongrel/LightTPD are:
  • Identical development and deployment environments
  • Handles multiple requests by maintaining JRuby runtimes and database connection pools
  • Ability to redploy an application without restarting container
  • In-built Clustering, Load Balancing, and High Availability support
  • Allows to leverage investment in a Java EE infrastructure and cohosting Ruby-on-Rails and Java EE applications
All the above mentioned reasons, and much more, are explained in detail in Rails powered by the GlassFish Application Server.

The gem installation is extremely simple as shown below:

~/testbed/jruby-1.1 >bin/jruby -S gem install glassfish
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Updating metadata for 93 gems from http://gems.rubyforge.org
.............................................................................................
complete
Successfully installed glassfish-0.1.2-universal-java
1 gem installed

After the gem is installed, get started by developing a simple scaffold application or Mephisto.

If you are attending JavaOne 2008, then LAB 8400 will show how to develop and deploy Rails applications using NetBeans and deploy them on GlassFish. LAB 4520 will teach you more about the modular and pluggable GlassFish v3 architecture.

GlassFish JRuby wiki or JRuby wiki gives you all the latest information about JRuby-on-Rails and GlassFish.

Technorati: jruby ruby rubyonrails netbeans glassfish v3 gem

Monday Mar 24, 2008

JRuby 1.1 RC3 released - Last chance to file bugs


JRuby 1.1 RC3 (third and final release candidate) was released last week. The highlights are:
  • 58 issues resolved since JRuby 1.1RC2
  • ri/rdoc w/ documentation included in distribution
  • More IO corner cases fixed (popen, reopen)
  • Several small bottlenecks fixed
This is your last chance to report any issues before JRuby 1.1 goes final. And I encourage you to try out GlassFish v3 Gem (ver 0.1.2) on this JRuby version and file any issues.

Why should you try ? Read in a detailed article - Rails powered by GlassFish Application Server.

The gem can be installed using the following command:

dhcp64-134-213-159:jruby-1.1RC3 arungupta$ bin/jruby -S gem install glassfish
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Updating metadata for 108 gems from http://gems.rubyforge.org
............................................................................................................
complete
Successfully installed glassfish-0.1.2-universal-java
1 gem installed

Previous entries showing code samples are tagged with v3+gem.

All the latest information about the gem can be found at GlassFish JRuby wiki or JRuby wiki.

Please use the gem and send us feedback on GlassFish forums, dev@glassfish or gem mailing list.

File issues in JIRA or RubyForge or GlassFish Issue Tracker.

Technorati: rubyonrails jruby ruby glassfish v3 gem
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today