Tuesday March 03, 2009
TOTD # 70: JRuby and GlassFish Integration Test# 1: JRuby 1.2.0 RC1 + Rails 2.2.x + GlassFish Gem
JRuby
1.2.0 RC1 is out for a while!
I typically run a series of tests to ensure that any publicly released
version of JRuby works nicely with GlassFish.
The main goal of running
these tests is to discover any blocking bugs before users do.
This particular set of tests are being run little late as RC1 was
released on Feb 24th. But I'll describe all the steps clearly in the
next few
blog entries so that you can try them out yourself.
JRuby team runs a whole slew of tests before releasing any bits.
Similarly we run a bunch of tests before releasing GlassFish Gem. These
tests, as mentioned earlier, are only to ensure that the latest release
of JRuby works nicely with the latest bits of GlassFish.
The first basic test is to check if a simple Rails application can be
run using the latest GlassFish
Gem. The steps are described next.
First, lets create a database user and grant privileges required by our
application:
| ~/tools >sudo
mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 30 Server version: 5.1.30 MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> create user duke@localhost identified by 'glassfish'; Query OK, 0 rows affected (0.00 sec) mysql> grant all on runner_development.* to duke@localhost identified by 'glassfish'; Query OK, 0 rows affected (0.03 sec) mysql> grant all on runner_production.* to duke@localhost identified by 'glassfish'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit; Bye |
| ~/tools/jruby-1.2.0RC1 >./bin/jruby -S gem install rails
glassfish JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL 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 Successfully installed rack-0.9.1 Successfully installed glassfish-0.9.2-universal-java 8 gems installed 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 ri documentation for rack-0.9.1... Installing ri documentation for glassfish-0.9.2-universal-java... 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... Installing RDoc documentation for rack-0.9.1... Installing RDoc documentation for glassfish-0.9.2-universal-java... |
| ~/tools/jruby-1.2.0RC1/samples/rails
>../../bin/jruby
-S rails runner -d mysql JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL create create app/controllers create app/helpers . . . create log/server.log create log/production.log create log/development.log create log/test.log |
| ~/tools/jruby-1.2.0RC1/samples/rails
>../../bin/jruby
-S gem install activerecord-jdbcmysql-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.9 Successfully installed jdbc-mysql-5.0.4 Successfully installed activerecord-jdbcmysql-adapter-0.9 3 gems installed Installing ri documentation for activerecord-jdbc-adapter-0.9... Installing ri documentation for jdbc-mysql-5.0.4... Installing ri documentation for activerecord-jdbcmysql-adapter-0.9... Installing RDoc documentation for activerecord-jdbc-adapter-0.9... Installing RDoc documentation for jdbc-mysql-5.0.4... Installing RDoc documentation for activerecord-jdbcmysql-adapter-0.9... |
| ~/tools/jruby-1.2.0RC1/samples/rails/runner
>../../../bin/jruby
script/generate scaffold runner
distance:float time: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/ . . . create test/fixtures/runners.yml create db/migrate create db/migrate/20090226171752_create_runners.rb |
| development: adapter: mysql encoding: utf8 database: runner_development pool: 5 username: root password: socket: /tmp/mysql.sock |
| development: adapter: jdbcmysql encoding: utf8 database: runner_development pool: 5 username: duke password: glassfish socket: /tmp/mysql.sock |
| ~/tools/jruby-1.2.0RC1/samples/rails/runner >../../../bin/jruby -S rake
db:create (in /Users/arungupta/tools/jruby-1.2.0RC1/samples/rails/runner) ~/tools/jruby-1.2.0RC1/samples/rails/runner >../../../bin/jruby -S rake db:migrate (in /Users/arungupta/tools/jruby-1.2.0RC1/samples/rails/runner) == CreateRunners: migrating ================================================== -- create_table(:runners) -> 0.1330s -> 0 rows == CreateRunners: migrated (0.1340s) ========================================= |
| ~/tools/jruby-1.2.0RC1/samples/rails/runner >../../../bin/jruby -S glassfish Feb 26, 2009 10:30:10 AM com.sun.enterprise.glassfish.bootstrap.ASMainStatic start INFO: Cache not present, will revert to less efficient algorithm Feb 26, 2009 10:30:10 AM com.sun.enterprise.glassfish.bootstrap.ASMainStatic findDerbyClient INFO: Cannot find javadb client jar file, jdbc driver not available Feb 26, 2009 10:30:10 AM APIClassLoaderService createAPIClassLoader INFO: APIClassLoader = java.net.URLClassLoader@14a66e3f no resource bundle found for version, using default GlassFish version Feb 26, 2009 10:30:11 AM AppServerStartup run INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started Feb 26, 2009 10:30:11 AM com.sun.enterprise.v3.services.impl.GrizzlyProxy start INFO: Listening on port 3000 Feb 26, 2009 10:30:11 AM com.sun.enterprise.v3.admin.adapter.AdminEndpointDecider setGuiContextRoot INFO: Admin Console Adapter: context root: /_____admingui Feb 26, 2009 10:30:11 AM com.sun.enterprise.v3.admin.adapter.AdminConsoleAdapter setStateMsg INFO: The Admin Console Application is not yet installed. Feb 26, 2009 10:30:11 AM com.sun.enterprise.v3.admin.adapter.AdminEndpointDecider setGuiContextRoot INFO: Admin Console Adapter: context root: /_____admingui Feb 26, 2009 10:30:11 AM org.glassfish.scripting.rails.RailsDeployer load INFO: Loading application runner at / Feb 26, 2009 10:30:11 AM com.sun.grizzly.jruby.RailsAdapter <init> INFO: Jruby version is: 1.2.0RC1 Feb 26, 2009 10:30:11 AM com.sun.grizzly.jruby.rack.RackApplicationChooser detectRails INFO: Detected Rails application Feb 26, 2009 10:30:11 AM com.sun.grizzly.jruby.rack.RackApplicationChooser detectRails INFO: Rails not in thread-safe mode, starting in single-thread mode Feb 26, 2009 10:30:11 AM com.sun.grizzly.pool.DynamicPool logDynamicStatus INFO: Pool started without dynamic resizing enabled. Pool will not attempt to determine the upper and lower bounds that it should be using, and will stay at 1 Feb 26, 2009 10:30:16 AM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Feb 26, 2009 10:30:18 AM INFO: RAILS_ROOT /Users/arungupta/tools/jruby-1.2.0RC1/samples/rails/runner Feb 26, 2009 10:30:18 AM INFO: PUBLIC_ROOT /Users/arungupta/tools/jruby-1.2.0RC1/samples/rails/runner/public Feb 26, 2009 10:30:19 AM com.sun.grizzly.pool.DynamicPool$1 run INFO: New instance created in 7,074 milliseconds Feb 26, 2009 10:30:19 AM com.sun.enterprise.v3.server.AppServerStartup run INFO: GlassFish v3 startup time : Static(525ms) startup services(7962ms) total(8487ms) Feb 26, 2009 10:30:19 AM com.sun.enterprise.glassfish.bootstrap.ASMainStatic start INFO: Started cache creation Feb 26, 2009 10:30:20 AM com.sun.enterprise.glassfish.bootstrap.ASMainStatic start INFO: Finished cache creation Feb 26, 2009 10:30:34 AM sun.reflect.NativeMethodAccessorImpl invoke0 INFO: |

Posted by Arun Gupta in web2.0 | Comments[10]
|
|
|
|
|
Today's Page Hits: 231
Total # blog entries: 1002
Posted by Arun Gupta's Blog on March 05, 2009 at 06:07 AM PST #
Posted by GlassFish on March 08, 2009 at 07:51 PM PDT #
Posted by Arun Gupta's Blog on March 09, 2009 at 06:39 AM PDT #
Posted by Arun Gupta's Blog on March 11, 2009 at 01:22 PM PDT #
Posted by Arun Gupta's Blog on March 16, 2009 at 11:49 AM PDT #
Posted by Arun Gupta's Blog on March 16, 2009 at 11:53 AM PDT #
I get this error during the db:migrate
$ ../../../bin/jruby -S rake db:migrate
rake aborted!
The driver encountered an error: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown database 'runner_development'
I have run db:create before migrate but doesn't look like it creates the database which I can confirm from MySQL explorer. However, if I pre-create the database through explorer for user duke, it works.
Posted by Roy on March 25, 2009 at 04:01 PM PDT #
Roy, db:create not working with MySQL is filed as:
http://jira.codehaus.org/browse/JRUBY-3502
Try using SQLite or some other database.
Posted by Arun Gupta on April 06, 2009 at 10:51 AM PDT #
Posted by Arun Gupta's Blog on April 28, 2009 at 06:16 AM PDT #
Posted by Arun Gupta's Blog on April 28, 2009 at 06:18 AM PDT #