Skip to main content

Rails GlassFish Gem 0.3.1 now available

Posted by arungupta on June 25, 2008 at 9:39 AM EDT
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
Related Topics >>