TOTD #70 shows the first integration integration tests that I typically run to ensure that the latest JRuby and GlassFish versions work nicely with each other. The second test (explained in this blog) ensures that the same application can be deployed using GlassFish v3 Prelude.
GlassFish v3 Prelude allows Rails applications to be deployed natively, i.e. without any packaging.
Lets begin integration test #2.
- Download and unzip GlassFish v3 Prelude. Fire up GlassFish v3 Prelude as:
~/tools/glassfish/v3/glassfishv3-prelude/glassfish >./bin/asadmin start-domain
Name of the domain started: [domain1] and
its location: [/Users/arungupta/tools/glassfish/v3/glassfishv3-prelude/glassfish/domains/domain1].
Admin port for the domain: [4848]. - Add JRUBY_HOME as “jvm-option” using the following command:
~/tools/glassfish/v3/glassfishv3-prelude/glassfish >./bin/asadmin create-jvm-options -DJRUBY_HOME=”/Users/arungupta/tools/jruby-1.2.0RC1″
created 1 option(s)Command create-jvm-options executed successfully.
This tells the GlassFish runtime to pick JRuby and related libraries from the directory specified in JRUBY_HOME.
- Deploy the application as:
~/tools/jruby-1.2.0RC1/samples/rails >~/tools/glassfish/v3/glassfishv3-prelude/bin/asadmin deploy runner Command deploy executed successfully.
- The application should now be accessible on “http://localhost:8080/runner/runners”. But instead the logs (located in “domains/domain1/logs/server.log) shows the following exception:
Caused by: java.lang.NumberFormatException: For input string: “0RC1″
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:456)
at java.lang.Integer.parseInt(Integer.java:497)
at com.sun.grizzly.jruby.RailsAdapter$JRubyVersion.<init>(RailsAdapter.java:137)
at com.sun.grizzly.jruby.RailsAdapter$JRubyVersion.<init>(RailsAdapter.java:131)
at com.sun.grizzly.jruby.RailsAdapter.<init>(RailsAdapter.java:110)
at com.sun.grizzly.jruby.RubyRuntime.<init>(RubyRuntime.java:48)
… 30 moreThis is filed as issue #7235 in GlassFish Issue Tracker.
- Lets try with the JRuby trunk.
- Check out JRuby trunk and build the workspace as shown below
~/workspaces >svn co http://svn.codehaus.org/jruby/trunk/jruby/
A jruby/bench
A jruby/bench/bench_tak.rb
A jruby/bench/bench_struct.rb. . .
A jruby/.settings/org.eclipse.jdt.core.prefs
A jruby/.settings/org.eclipse.jdt.ui.prefs
U jruby
Checked out revision 9347.
~/workspaces >cd jruby/
~/workspaces/jruby >ant
Buildfile: build.xmlinit:
jar:
. . .
_update_scm_revision_:
[jar] Building jar: /Users/arungupta/workspaces/jruby/lib/jruby.jar
[jar] Warning: selected jar files include a META-INF/INDEX.LIST which will be replaced by a newly generated one.BUILD SUCCESSFUL
Total time: 1 minute 21 seconds - Install Rails
~/workspaces/jruby >./bin/jruby gem install rails
JRuby limited openssl loaded. gem install jruby-openssl for full support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Successfully installed rake-0.8.4
Successfully installed activesupport-2.2.2
Successfully installed activerecord-2.2.2
Successfully installed actionpack-2.2.2
Successfully installed actionmailer-2.2.2
Successfully installed activeresource-2.2.2
Successfully installed rails-2.2.2
7 gems installed
Installing ri documentation for rake-0.8.4…
Installing ri documentation for activesupport-2.2.2…
Installing ri documentation for activerecord-2.2.2…
Installing ri documentation for actionpack-2.2.2…
Installing ri documentation for actionmailer-2.2.2…
Installing ri documentation for activeresource-2.2.2…
Installing RDoc documentation for rake-0.8.4…
Installing RDoc documentation for activesupport-2.2.2…
Installing RDoc documentation for activerecord-2.2.2…
Installing RDoc documentation for actionpack-2.2.2…
Installing RDoc documentation for actionmailer-2.2.2…
Installing RDoc documentation for activeresource-2.2.2…
- Check out JRuby trunk and build the workspace as shown below
- Delete the previously added jvm-option as
~/tools/glassfish/v3/glassfishv3-prelude/glassfish >./bin/asadmin delete-jvm-options -DJRUBY_HOME=”/Users/arungupta/tools/jruby-1.2.0RC1″
deleted 1 option(s)Command delete-jvm-options executed successfully.
and add a new jvm-option pointing to the the new JRUBY_HOME as
~/tools/glassfish/v3/glassfishv3-prelude/glassfish >./bin/asadmin create-jvm-options -DJRUBY_HOME=”/Users/arungupta/workspaces/jruby”
created 1 option(s)Command create-jvm-options executed successfully.
- Deploy th
e application as:~/tools/jruby-1.2.0RC1/samples/rails >~/tools/glassfish/v3/glassfishv3-prelude/bin/asadmin deploy –force=true runner Command deploy executed successfully.
The “NumberFormatException” as seen above is shown again in this case.
If the application is deployed correctly then “http://localhost:8080/runner/runners” will show the scaffold page. The final JRuby 1.2 release will not have any text letters in the version and so you’ll be able to deploy a Rails application using JRuby 1.2 (final release) on GlassFish v3 Prelude.
But for now our test #2 has failed.
Subsequent blogs will show the remainder of tests. The current set of tests are available using the tags rubyonrails+glassfish+integrationtest.
Please leave suggestions on other TOTD (Tip Of The Day) that you’d like to see. A complete archive of all tips is available here.
Technorati: totd rubyonrails glassfish v3 jruby gem integrationtest
Related posts:- TOTD #72: JRuby and GlassFish Integration Test #3: JRuby 1.2.0 RC2 + Rails 2.2.x + GlassFish v3
- TOTD #73: JRuby and GlassFish Integration Test #4: JRuby 1.2.0 RC2 + Rails 2.2.x + GlassFish v2 + Warbler
- TOTD #70: JRuby and GlassFish Integration Test# 1: JRuby 1.2.0 RC1 + Rails 2.2.x + GlassFish Gem
- TOTD #74: JRuby and GlassFish Integration Test #5: JRuby 1.2.0 RC2 + Rails 2.x.x + GlassFish + Redmine
- Getting Started with Edge Rails (2.2) using JRuby and GlassFish
[Trackback] TOTD #70 and #71 shows the first two integration tests that I typically run to ensure that the latest JRuby and GlassFish versions work nicely with each other. #70 showed how to create a trivial Rails application and run it…
Comment by Arun Gupta's Blog — March 9, 2009 @ 6:39 am
[Trackback] TOTD #70, #71, #72 shows the first three integration tests that I typically run to ensure that the latest JRuby and GlassFish versions work nicely with each other. #70 showed how to create a trivial Rails application and run…
Comment by Arun Gupta's Blog — March 11, 2009 @ 1:22 pm
[Trackback] TOTD #70, #71, #72, #73 shows four integration tests that can ensure that the latest JRuby and GlassFish versions work nicely with each other. #70 showed how to create a trivial Rails application and run it using GlassFish Gem. #71…
Comment by Arun Gupta's Blog — March 16, 2009 @ 11:49 am
[Trackback] TOTD #70, #71, #72, #73 shows four integration tests that can ensure that the latest JRuby and GlassFish versions work nicely with each other. #70 showed how to create a trivial Rails application and run it using GlassFish Gem. #71…
Comment by Arun Gupta's Blog — March 16, 2009 @ 11:53 am
[Trackback] This is a follow up post from David’s keynote. Attended Women in Rails panel discussion. The panel, Sarah Mei, Lori Olson, and Desi McAdam (from L to R), had a very interesting discussion around the genuine problems and possible solutions…
Comment by Arun Gupta's Blog — May 6, 2009 @ 5:40 am