Thursday July 02, 2009
Rails on GlassFish - "most performant of all", "simpler and just works", "blazing speed"
Here are some quotes about running Rails applications on GlassFish from user@jruby
mailing list:
I find the glassfish gem
to be the most performant of all -- and I don't need to war-up my app.
I also have some mongrel
cluster stuff, but glassfish is simpler and just works.
Voila...blazing speed,
can handle lots of traffic. Note that I am also cominging into apache
from a dyndns name. So, whatever IP I have, I can go straight to
execution on the glassfish gem and NO warring up! What could be easier
deployment, or a faster execution?
It's running fantasticly
and performing like nothing I've seen before :) Completely stable
memory, no wirings or anything bad for 5 days now.. (with several
ab/htperf stresstests).
It's always exciting to get good endorsements of our efforts in the
GlassFish team :)
Other similar stories for using Rails/GlassFish in production are
described at rubyonrails+stories.
Technorati: glassfish
v3 gem rubyonrails
stories
jruby
Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
Thursday April 30, 2009
TOTD #81: How to use nginx to load balance a cluster of GlassFish Gem ?
![]() |
nginx (pronounced as "engine-ex") is an open-source and high-performance HTTP server. It provides the common features such as reverse proxying with caching, load balancing, modular architecture using filters (gzipping, chunked responses, etc), virtual servers, flexible configuration and much more. |
| ~/tools
> curl -L -O http://sysoev.ru/nginx/nginx-0.6.36.tar.gz ~/tools > tar -xzf nginx-0.6.36.tar.gz ~/tools > curl -L -O http://downloads.sourceforge.net/pcre/pcre-7.7.tar.gz ~/tools > tar -xzf pcre-7.7.tar.gz ~/tools/nginx-0.6.36 > ./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin --with-debug --with-http_ssl_module --with-pcre=../pcre-7.7 ~/tools/nginx-0.6.36 > make ~/tools/nginx-0.6.36 > sudo make install ~/tools/nginx-0.6.36 > which nginx /usr/sbin/nginx |

| ~/samples/jruby >~/tools/jruby/bin/jruby -S rails
runner ~/samples/jruby/runner >~/tools/jruby/bin/jruby script/generate scaffold runlog miles:float minutes:integer ~/samples/jruby/runner >sed s/'adapter: sqlite3'/'adapter: jdbcsqlite3'/ <config/database.yml >config/database.yml.new ~/samples/jruby/runner >mv config/database.yml.new config/database.yml ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S rake db:migrate |
| ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S
glassfish Starting GlassFish server at: 192.168.1.145:3000 in development environment... Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log. Press Ctrl+C to stop. |
| ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S
glassfish -p 3001 Starting GlassFish server at: 192.168.1.145:3001 in development environment... Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log. Press Ctrl+C to stop. |
| ~/samples/jruby/runner >~/tools/jruby/bin/jruby -S
glassfish -p 3002 Starting GlassFish server at: 192.168.1.145:3002 in development environment... Writing log messages to: /Users/arungupta/samples/jruby/runner/log/development.log. Press Ctrl+C to stop. |
| upstream
glassfish { server 127.0.0.1:3000; server 127.0.0.1:3001; server 127.0.0.1:3002; } |

| proxy_pass http://glassfish; |

| sudo
kill -15 `cat /usr/local/nginx/logs/nginx.pid` sudo nginx |

| log_format
main '$remote_addr - [$upstream_addr]
$remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; |
| 127.0.0.1 - [127.0.0.1:3000]
- [29/Apr/2009:15:27:57 -0700] GET
/runlogs/ HTTP/1.1 "200" 3689 "-" "Mozilla/5.0 (Macintosh;
U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like
Gecko) Version/3.2.1 Safari/525.27.1" "-" 127.0.0.1 - [127.0.0.1:3001] - [29/Apr/2009:15:27:57 -0700] GET /favicon.ico HTTP/1.1 "200" 0 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-" 127.0.0.1 - [127.0.0.1:3002] - [29/Apr/2009:15:27:57 -0700] GET /stylesheets/scaffold.css?1240977992 HTTP/1.1 "200" 889 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-" |
| 127.0.0.1 - [127.0.0.1:3000]
- [29/Apr/2009:15:28:53 -0700] GET /runlogs/ HTTP/1.1 "200" 3689 "-"
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us)
AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1"
"-" 127.0.0.1 - [127.0.0.1:3002, 127.0.0.1:3000] - [29/Apr/2009:15:28:53 -0700] GET /favicon.ico HTTP/1.1 "200" 0 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-" 127.0.0.1 - [127.0.0.1:3001] - [29/Apr/2009:15:28:53 -0700] GET /stylesheets/scaffold.css?1240977992 HTTP/1.1 "200" 889 "http://localhost/runlogs/" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1" "-" |
Posted by Arun Gupta in web2.0 | Comments[8]
|
|
|
|
|
Friday March 20, 2009
Oh, what a week for the JRuby, Rails, and GlassFish enthusiasts!
JRuby
1.2, Rails
2.3, GlassFish
Gem 0.9.3, and ActiveRecord
JDBC Adapater 0.9.1 - all released earlier this week. This is
an
opportune moment to run the integration
tests to ensure the latest
JRuby and GlassFish versions work nicely with each other.
First, lets see whats there to get exicted in each release.
JRuby 1.2 introduces a new versioning scheme by jumping from 1.1.6
-> 1.2. JRUBY-3649 is an important fix for the Windows users.
Improved
Ruby 1.9 support, 3-6x faster parsing, and preliminary android support
are some other
highlights. 1052 revisions and
256 bugfixes since 1.1.6 (89 days ago) means close to 12 revisions /
day and 3 bugfixes/day!
Rails 2.3 has a bunch of highlights ranging from Rack integration,
nested forms,
attributes,
and transactions,
reconnecting
lost MySQL connections, Application
controller renamed (make sure to "rake
rails:update:action_controller" to update from an older version), faster
boot time in dev mode using lazy loading, and many others.
The Release
Notes provide all the detailed information.
The GlassFish Gem with features like running as daemon,
rake-style configuration of JVM options, ability to "sudo
install" gem and run as normal user and multi-level logging are all
gearing
towards adding more production-quality features. My favorite here is
running as
daemon since that brings the Gem one step closer to the Rails community.
Lets get back to running our tests #1,
#2,
#3,
#4,
and #5
for these released versions.
First, lets unzip JRuby
1.2 and install Rails 2.3, GlassFish Gem 0.9.3, and other
gems as:
| ~/tools/jruby-1.2.0 >./bin/jruby -S gem install rails
glassfish activerecord-jdbcmysql-adapter JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Successfully installed activesupport-2.3.2 Successfully installed activerecord-2.3.2 Successfully installed actionpack-2.3.2 Successfully installed actionmailer-2.3.2 Successfully installed activeresource-2.3.2 Successfully installed rails-2.3.2 Successfully installed rack-0.9.1 Successfully installed glassfish-0.9.3-universal-java Successfully installed activerecord-jdbc-adapter-0.9.1 Successfully installed jdbc-mysql-5.0.4 Successfully installed activerecord-jdbcmysql-adapter-0.9.1 11 gems installed Installing ri documentation for activesupport-2.3.2... Installing ri documentation for activerecord-2.3.2... Installing ri documentation for actionpack-2.3.2... Installing ri documentation for actionmailer-2.3.2... Installing ri documentation for activeresource-2.3.2... Installing ri documentation for rack-0.9.1... Installing ri documentation for glassfish-0.9.3-universal-java... Installing ri documentation for activerecord-jdbc-adapter-0.9.1... Installing ri documentation for jdbc-mysql-5.0.4... Installing ri documentation for activerecord-jdbcmysql-adapter-0.9.1... Installing RDoc documentation for activesupport-2.3.2... Installing RDoc documentation for activerecord-2.3.2... Installing RDoc documentation for actionpack-2.3.2... Installing RDoc documentation for actionmailer-2.3.2... Installing RDoc documentation for activeresource-2.3.2... Installing RDoc documentation for rack-0.9.1... Installing RDoc documentation for glassfish-0.9.3-universal-java... Installing RDoc documentation for activerecord-jdbc-adapter-0.9.1... Installing RDoc documentation for jdbc-mysql-5.0.4... Installing RDoc documentation for activerecord-jdbcmysql-adapter-0.9.1... |
| ~/tools/jruby-1.1.6 >./bin/jruby -S gem update
glassfish JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Updating installed gems Updating glassfish Successfully installed glassfish-0.9.3-universal-java Gems updated: glassfish |
| ~/tools/jruby-1.1.6 >./bin/jruby -S gem update
activerecord JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Updating installed gems Updating activerecord-jdbc-adapter Successfully installed activerecord-jdbc-adapter-0.9.1 Updating activerecord-jdbcmysql-adapter Successfully installed activerecord-jdbcmysql-adapter-0.9.1 Updating activerecord-jdbcsqlite3-adapter Successfully installed jdbc-sqlite3-3.6.3.054 Successfully installed activerecord-jdbcsqlite3-adapter-0.9.1 Updating merb_activerecord Successfully installed merb_activerecord-1.0.0.1 Gems updated: activerecord-jdbc-adapter, activerecord-jdbcmysql-adapter, jdbc-sqlite3, activerecord-jdbcsqlite3-adapter, merb_activerecord |
| ~/tools/jruby-1.2.0 >./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 jdbc-sqlite3-3.6.3.054 Successfully installed activerecord-jdbcsqlite3-adapter-0.9.1 2 gems installed Installing ri documentation for jdbc-sqlite3-3.6.3.054... Installing ri documentation for activerecord-jdbcsqlite3-adapter-0.9.1... Installing RDoc documentation for jdbc-sqlite3-3.6.3.054... Installing RDoc documentation for activerecord-jdbcsqlite3-adapter-0.9.1... |
| ~/tools/jruby-1.2.0/samples/rails
>../../bin/jruby -S rails runner create create app/controllers create app/helpers . . . create log/production.log create log/development.log create log/test.log |
| development: adapter: sqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 |
| development: adapter: jdbcsqlite3 database: db/development.sqlite3 pool: 5 timeout: 5000 |
| ActionController::Base.session_store = :active_record_store |
| config.webxml.jruby.session_store = 'db' |
| if defined?(JRUBY_VERSION) # hack to fix jruby-rack's incompatibility with rails edge module ActionController module Session class JavaServletStore def initialize(app, options={}); end def call(env); end end end end end |
| Test # | Description | Status |
| #1 | Simple Scaffold using GlassFish Gem | PASS (with workaround in JRUBY-3502) |
| #2 | Simple Scaffold using GlassFish v3 Prelude | PASS |
| #3 | Simple Scaffold using GlassFish v3 | FAIL (used workaround mentioned in JRUBY-3502, issues #7266, #7270, #7271 still need to be fixed). PASS if the Application and Controller name are different. |
| #4 | Simple Scaffold as WAR-based application on GlassFish v2.1 | FAIL (issue #7385), PASS (with workaround in issue JRUBY-3515) |
| #5 | Redmine using GlassFish Gem | PASS |
Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Monday March 16, 2009
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
showed how the same application can be deployed on GlassFish
v3 Prelude. #72
showed how to deploy the same application on GlassFish v3. #73
showed how to deploy a Rails application as WAR file and use the JDBC
connection pooling framework available in GlassFish.
The next set of tests ensure that some commonly used open source Rails
applications can be easily run using this setup. The first one is
Redmine - 0.8 is the stable release now. Redmine was first tried on
GlassFish a
few months ago. The steps have simplified since then :)
Lets begin integration test #5.
| /samples/jruby/redmine >svn co
http://redmine.rubyforge.org/svn/branches/0.8-stable redmine-0.8 A redmine-0.8/test A redmine-0.8/test/unit A redmine-0.8/test/unit/document_test.rb A redmine-0.8/test/unit/token_test.rb . . . A redmine-0.8/public/stylesheets/scm.css A redmine-0.8/public/stylesheets/application.css A redmine-0.8/public/favicon.ico U redmine-0.8 Checked out revision 2580. |
| ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S
rake db:create (in /Users/arungupta/samples/jruby/redmine/redmine-0.8) ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S rake db:migrate (in /Users/arungupta/samples/jruby/redmine/redmine-0.8) == 1 Setup: migrating ========================================================= -- create_table("attachments", {:force=>true}) -> 0.0880s -- create_table("auth_sources", {:force=>true}) -> 0.1430s . . . == 100 AddChangesetsUserId: migrating ========================================= -- add_column(:changesets, :user_id, :integer, {:default=>nil}) -> 0.0980s == 100 AddChangesetsUserId: migrated (0.0990s) ================================ == 101 PopulateChangesetsUserId: migrating ==================================== == 101 PopulateChangesetsUserId: migrated (0.0030s) =========================== |
| ~/samples/jruby/redmine/redmine-0.8 >../jruby-1.2.0RC2/bin/jruby -S
glassfish Mar 13, 2009 11:14:59 AM com.sun.enterprise.glassfish.bootstrap.ASMainStatic findDerbyClient INFO: Cannot find javadb client jar file, jdbc driver not available Mar 13, 2009 11:14:59 AM APIClassLoaderService createAPIClassLoader INFO: APIClassLoader = java.net.URLClassLoader@59fb8de1 . . . Mar 13, 2009 11:15:10 AM com.sun.grizzly.pool.DynamicPool$1 run INFO: New instance created in 10,175 milliseconds Mar 13, 2009 11:15:10 AM com.sun.enterprise.v3.server.AppServerStartup run INFO: GlassFish v3 startup time : Static(356ms) startup services(11456ms) total(11812ms) |







Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Monday March 09, 2009
TOTD # 72: JRuby and GlassFish Integration Test #3: JRuby 1.2.0 RC2 + Rails 2.2.x + GlassFish v3
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 using GlassFish
Gem. #71
showed how the same application can be deployed on GlassFish
v3 Prelude.
The third test (explained in this blog) ensures that the
same
application can be easily deployed using GlassFish
v3. GlassFish v3 will be available later this year with full
support for Java EE 6.
JRuby 1.2.0 RC2 is now released. Test
#1 passed, Test
#2 gives the following error:
| Caused by: java.lang.NumberFormatException: For input
string: "0RC2" 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) ... 22 more |

| ~/tools/glassfish/v3/b39/glassfishv3/glassfish
>./bin/asadmin
start-domain Name of the domain started: [domain1] and its location: [/Users/arungupta/tools/glassfish/v3/b39/glassfishv3/glassfish/domains/domain1]. Admin port for the domain: [4848]. |
| ~/tools/glassfish/v3/b39/glassfishv3/glassfish
>./bin/asadmin
create-jvm-options -DJRUBY_HOME="/Users/arungupta/tools/jruby-1.2.0RC2" created 1 option(s) Command create-jvm-options executed successfully. |
| ~/tools/jruby-1.2.0RC1/samples/rails >~/tools/glassfish/v3/b39/glassfishv3/bin/asadmin
deploy runner Command deploy executed successfully. |
| ActionController::RoutingError (No route matches
"s" with {:method=>:get}): /Users/arungupta/tools/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path' /Users/arungupta/tools/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:386:in `recognize' /Users/arungupta/tools/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:182:in `handle_request' /Users/arungupta/tools/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked' /Users/arungupta/tools/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:in `dispatch' /Users/arungupta/tools/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in `dispatch' /Users/arungupta/tools/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi' /Users/arungupta/tools/jruby-1.2.0RC1/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:in `dispatch' file:/Users/arungupta/tools/glassfish/v3/b39/glassfishv3/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:82:in `serve_rails' file:/Users/arungupta/tools/glassfish/v3/b39/glassfishv3/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:109:in `call' file:/Users/arungupta/tools/glassfish/v3/b39/glassfishv3/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:81:in `call' file:/Users/arungupta/tools/glassfish/v3/b39/glassfishv3/glassfish/modules/grizzly-jruby.jar!/rack/handler/grizzly.rb:55:in `call' :1 |
| ~/tools/jruby-1.2.0RC1/samples/rails >~/tools/glassfish/v3/b39/glassfishv3/bin/asadmin
deploy --contextroot runlog --force=true runner Command deploy executed successfully. |
| ~/tools/jruby-1.2.0RC2/samples/rails >~/tools/glassfish/v3/b39/glassfishv3/bin/asadmin
deploy runlog Command deploy executed successfully. |

Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
Thursday March 05, 2009
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.
| ~/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]. |
| ~/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. |
| ~/tools/jruby-1.2.0RC1/samples/rails >~/tools/glassfish/v3/glassfishv3-prelude/bin/asadmin
deploy runner Command deploy executed successfully. |
| 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 more |
| ~/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.xml init: 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 |
| ~/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... |
| ~/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. |
| ~/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. |
| ~/tools/jruby-1.2.0RC1/samples/rails >~/tools/glassfish/v3/glassfishv3-prelude/bin/asadmin
deploy --force=true runner Command deploy executed successfully. |
Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
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]
|
|
|
|
|
Friday November 21, 2008
TOTD #55: How to build GlassFish v3 Gem ?
GlassFish
Gem is a light-weight and robust deployment solution for
Ruby-on-Rails
and Merb
applications. The gem can be easily installed as:
| gem install glassfish |
| svn co
https://svn.dev.java.net/svn/glassfish-scripting/trunk/rails/v3/gem gem cd gem mvn -U clean install |
Posted by Arun Gupta in web2.0 | Comments[2]
|
|
|
|
|
Tuesday November 18, 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.

| ~/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 |
| ~/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 |
| ~/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. |
| :development: &defaults :adapter: mysql :database: hello_development :username: root :password: :host: localhost :socket: /tmp/mysql.sock :encoding: utf8 |
| ~/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 |
| ~/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` |
| require 'config/dependencies.rb' |
| dependency "merb-assets", "1.0" dependency "merb-helpers", "1.0" |
| resources :runners |
| <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) %> |
| <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) %> |
| <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) %> |
| <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) %> |





Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
Friday November 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.

| ~/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... |
| ~/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). |
| ~/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... |
| ~/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 |
| ~/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 |
|
def index @message = "Miles to go ..." render end |



Posted by Arun Gupta in web2.0 | Comments[7]
|
|
|
|
|
Monday July 21, 2008
JRuby 1.1.3 released - Getting Started with GlassFish
JRuby 1.1.3 was released
last week - download
here. The highlights are:
| ~/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 |
| ~/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 |
| ~/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 |
| ~/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 |
| ~/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) =========================== |


| ~/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 |
| ~/testbed/jruby-1.1.3/samples/rails
>~/testbed/glassfish/v3/snapshot/glassfish/bin/asadmin
deploy helloworld Command deploy executed successfully. |
| 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 |

Posted by Arun Gupta in web2.0 | Comments[9]
|
|
|
|
|
Wednesday July 02, 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. |
| ~/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 |
| # 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 |
| ~/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... |
| development: adapter: jdbcsqlite3 database: db/development.sqlite3 timeout: 5000 |
| ~/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 |
| ~/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) ============================== |
| development: adapter: jdbcsqlite3 database: runner/db/development.sqlite3 timeout: 5000 |
| ~/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 |

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive is available here.
Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
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]
|
|
|
|
|
Wednesday June 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:
| ~/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 |
| ~/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 |
| ~/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 |
| ~/testbed/rails21/jruby-1.1.2/samples/rails
>~/testbed/glassfish/v3/tp2/glassfishv3-tp2/glassfish/bin/asadmin
deploy runner Command deploy executed successfully. |
| 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 |

| ~/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) ========================= |
| config.time_zone = 'Pacific Time (US & Canada)' |


| ~/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 |
| ~/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 |

Posted by Arun Gupta in web2.0 | Comments[6]
|
|
|
|
|
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:
| ~/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 > |
| ~/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 |
| ~/testbed/jruby-1.1.2
>bin/jruby -S gem
list g
*** LOCAL GEMS *** glassfish (0.2.0) |
| ~/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 |

Posted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
|
Today's Page Hits: 950
Total # blog entries: 1025