Wednesday June 25, 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 |
| ~/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 |

| ~/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 |
| 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] |
Posted by Arun Gupta in web2.0 | Comments[6]
|
|
|
|
|
Today's Page Hits: 163
Total # blog entries: 1025
Posted by Arun Gupta's Blog on June 30, 2008 at 11:05 AM PDT #
Posted by Arun Gupta's Blog on July 02, 2008 at 06:24 AM PDT #
Thanks for your detailed tips.
I installed jruby-1.1.3 and glassfish 0.3.1 (sorry - I had to install from scratch :) and my micro example worked fine.
So I tried to launch my own (somewhat bigger) project with jruby and glassfish (11 models, 13 controllers, 3 plugins [attachment_fu, open_id_authentication, restful-authentication]) - and with just a minor glitch - it worked.
I noticed that I have to change my database config to:
development:
adapter: jdbcsqlite3
database: projecttracker/db/development.sqlite3
timeout: 5000
And that was it.
2 questions:
a) Is there a way to detect the glassfish environment in ruby/rails -> so that I could dynamically add the additional path to the development.sqlite3 file? (Not needed for standalone DBs :)
b) Is there a way to package my application into a WAR file and deploy only this WAR file on a glassfish (v3) server?
Posted by Rene A. on July 27, 2008 at 12:07 PM PDT #
Rene,
I believe a) happens only for SQLite3. Can you file an RFE at:
https://glassfish.dev.java.net/issues/enter_bug.cgi?issue_type=ENHANCEMENT
using "jruby" sub-component ?
Yes, Rails application can be easily bundled into a WAR file as described at:
http://blogs.sun.com/arungupta/entry/war_based_packaging_and_deployment
In fact this is a very popular option that s used for deployment.
Posted by Arun Gupta on July 28, 2008 at 04:38 PM PDT #
Hi Arun,
firstly: many thanks for your efforts in providing a stable deployment solution for the JRuby on Rails environment: your job is already great and will be surely better in future releases!
Said that, i have migrated from glassfish gem 0.2 to 0.3 and noticed that the AS also log response return messages into the views of my application.
This does not happens always, but when it does affects both normal HTTP requests and Ajax requests (for example i see the response status into the in-place-editor fields).
A logging string example:
HTTP/1.1 200 OK Content-Type: text/html; charset=iso-8859-1 Transfer-Encoding: chunked Date: Tue, 29 Jul 2008 07:34:43 GMT
Any idea on how to remove this logging?
Thank you again and greetings.
Michele
Posted by Michele Costa on July 29, 2008 at 12:36 AM PDT #
Rene, Filed https://glassfish.dev.java.net/issues/show_bug.cgi?id=5404 to track your issue.
Posted by Arun Gupta on July 30, 2008 at 09:38 AM PDT #