Monday September 08, 2008
TOTD #44: JDBC Connection Pooling for Rails on GlassFish v3
TOTD
#9 explained how to configure JDBC connection pooling for
Rails application deployed on GlassFish v2. There are several
benefits of using using the JDBC connection pools:
| ~/samples/jruby >~/tools/jruby-1.1.3/bin/jruby -S
rails
jndi_rails2 -d mysql ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby script/generate scaffold runner miles:float minutes:integer ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S rake db:create ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S rake db:migrate |
| ~/samples/jruby/jndi_rails2 >~/tools/jruby-1.1.3/bin/jruby -S gem install activerecord-jdbcmysql-adapter |
| ~/samples/jruby/jndi_rails2 >sudo cp ~/tools/mysql-connector-java-5.1.6/mysql-connector-java-5.1.6-bin.jar /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/lib/ext |
| ~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish >java -Xmx512m -DJRUBY_HOME=/Users/arungupta/tools/jruby-1.1.3 -jar modules/glassfish-10.0-SNAPSHOT.jar |
| ~/samples/jruby/jndi_rails2 >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype javax.sql.DataSource --property "User=duke:Password=duke:URL=jdbc\:mysql\://localhost/jndi_rails2_production" jdbc/jndi_rails2_pool |
| ~/samples/jruby/jndi_rails2 >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin create-jdbc-resource --connectionpoolid jdbc/jndi_rails2_pool jdbc/jndi_rails2 |
| ~/samples/jruby >~/tools/glassfish/v3/b23/glassfishv3-prelude/glassfish/bin/asadmin ping-connection-pool jdbc/jndi_rails2_pool |
|
development: adapter: jdbc jndi: jdbc/jndi_rails2 driver: com.mysql.jdbc.Driver |
| ~/samples/jruby >~/tools/glassfish/v3/b22/glassfishv3-prelude/glassfish/bin/asadmin deploy jndi_rails2 |
Posted by Arun Gupta in web2.0 | Comments[11]
|
|
|
|
|
Thursday August 28, 2008
Typo on GlassFish v3 - Ruby-on-Rails Blogging Engine
![]() |
Typo is an open-source Blogging Engine written using Ruby-on-Rails framework. It provides a lean engine that makes blogging easy. It's main attribtues are ease of use, usability, beauty and excellent support of web standards. |
| JRuby
limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Building native extensions. This could take a while... /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (NotImplementedError) from /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/1.8/mkmf.rb:1:in `require' from extconf.rb:1 ERROR: Error installing typo: ERROR: Failed to build gem native extension. /Users/arungupta/tools/rails20/jruby-1.1.3/bin/jruby extconf.rb install typo Gem files will remain installed in /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection. Results logged to /Users/arungupta/tools/rails20/jruby-1.1.3/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out |
| ~/samples/jruby
>unzip
~/Downloads/typo-5.1.2.zip Archive: /Users/arungupta/Downloads/typo-5.1.2.zip creating: typo-5.1.2/ creating: typo-5.1.2/app/ creating: typo-5.1.2/app/apis/ . . . inflating: typo-5.1.2/vendor/uuidtools/lib/uuidtools.rb inflating: typo-5.1.2/vendor/uuidtools/rakefile inflating: typo-5.1.2/vendor/uuidtools/README |
| ~/samples/jruby >sudo mysqladmin create typo_dev |
| ~/samples/jruby/typo-5.1.2
>~/tools/rails20/jruby-1.1.3/bin/jruby
-S rake db:migrate (in /Users/arungupta/samples/jruby/typo-5.1.2) == 1 InitialSchema: migrating ================================================= -- create_table(:users) -> 0.0377s -- create_table(:articles) -> 0.0189s -- add_index(:articles, :permalink) -> 0.0094s -- create_table(:categories) -> 0.0069s . . . == 69 AddModulesToProfile: migrating ========================================== -- add_column(:profiles, :modules, :text) -> 0.0072s == 69 AddModulesToProfile: migrated (0.0454s) ================================= == 70 AddUsersToNonAdmins: migrating ========================================== == 70 AddUsersToNonAdmins: migrated (0.0488s) ================================= |
| ~/tools/glassfish/v3/8-24
>unzip
~/Downloads/glassfish-snapshot-v3-prelude-08_24_2008.zip Archive: /Users/arungupta/Downloads/glassfish-snapshot-v3-prelude-08_24_2008.zip creating: glassfish/ creating: glassfish/docs/ creating: glassfish/docs/css/ creating: glassfish/docs/graphics/ . . . inflating: glassfish/lib/templates/login.conf inflating: glassfish/lib/templates/profile.properties inflating: glassfish/lib/templates/server.policy |
| ~/tools/glassfish/v3/8-24/glassfish
>java
-DJRUBY_HOME=/Users/arungupta/tools/rails20/jruby-1.1.3 -jar
modules/glassfish-10.0-SNAPSHOT.jar Aug 26, 2008 5:56:10 PM com.sun.enterprise.glassfish.bootstrap.ASMain main INFO: Launching GlassFish on Apache Felix OSGi platform Welcome to Felix. ================= Aug 26, 2008 5:56:11 PM HK2Main start INFO: contextRootDir = /Users/arungupta/tools/glassfish/v3/8-24/glassfish/modules Aug 26, 2008 5:56:11 PM OSGiFactoryImpl initialize . . . INFO: APIClassLoader = Class Loader for Bundle [GlassFish-Application-Common-Module [66] ] Aug 26, 2008 5:56:13 PM CommonClassLoaderManager Skipping creation of CommonClassLoader as there are no libraries available INFO: urls = [] Aug 26, 2008 5:56:13 PM com.sun.enterprise.v3.server.AppServerStartup run INFO: Glassfish v3 started in 2176 ms |
| ~/samples/jruby >~/tools/glassfish/v3/8-24/glassfish/bin/asadmin
deploy typo-5.1.2 Command deploy executed successfully. |







Posted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
|
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]
|
|
|
|
|
Tuesday July 08, 2008
NetBeans 6.5 M1: GlassFish v3 + Rails
NetBeans IDE 6.5 Milestone 1 is now available.
The New
and Noteworthy feature list certainly makes it worthy for the
install - comprehensive PHP support (Editor
Screencast and PHP
Learning Trail), JavaScript
Debugger, Groovy
Editor, Grails
support and Numerous improvements in other areas are some of
them.
Let's get started!










Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
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]
|
|
|
|
|
Tuesday June 24, 2008
JRuby-on-Rails and MySQL on GlassFish on OpenSolaris in Virtual Box VM
My primary development machine is Mac OS Leopard
on Intel Core 2 Duo (read osxtips).
But the beauty of virtualization
is that I can run multiple Operating Systems on a single powerful
machine. And what better virtualization product than Virtual Box.
And Open
Solaris has crossed leaps and boundaries making installation
and getting started extremely simple :)
So here is an application stack that I tried:
![]() |
Rails 2.1
+ My
SQL 5.0.51a JRuby 1.1.2 GlassFish v3 TP2 OpenSolaris 2008.05 Virtual Box 1.6.2 Mac OSX Leopard Intel 2.4 G Hz Core 2 Duo |









Posted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
|
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]
|
|
|
|
|
Monday June 02, 2008
Tic Tac Toe using Rails and Grails on GlassFish v3
GlassFish v3
is a modular
(OSGi compliant), embeddable (runs in-VM) and extensible (hosts
non-Java applications) Application Server. The "extensible" part was
demonstrated during JavaOne
2008 by deploying Rails,
Grails and Django sample
application on GlassFish
v3 Technology Preview 2. This blog announces the availability
of Rails, Grails and (of course!) Java EE version of the demo code.
The
sample application is a simple multi-player game that can be played on
Internet and deployed on GlassFish. One of the simplest multi-player
game is Tic-Tac-Toe.
The complete instructions to checkout, build, deploy and run the sample
are available here.
The demo can certainly be improved by using the best practices from
Rails and Grails and I'll work on them in next few days.
The
demo is played in 2 different browser windows (tested on Firefox,
Safari & IE). The clicks in the grid on one browser are
displayed
on the other browser (propagated using GlassFish Comet) and row and
column winners are shown.

Posted by Arun Gupta in web2.0 | Comments[15]
|
|
|
|
|
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]
|
|
|
|
|
Friday May 23, 2008
Redmine on GlassFish - Ruby-on-Rails Project Management Application
Redmine is a flexible project management web application
written using Ruby on
Rails framework. The feature list
is pretty comprehensive from the usual suspects like multiple projects,
role-based control, forums/wikis/SCM for each project to enterprise
level features such as LDAP-authentication and multiple languages. It
is cross-platform and cross-database and deploys very nicely on GlassFish
v3.
GlassFish v3 modularity and extensibility allows Rails applications to
be deployed without
any modification (no WARing). This blog explains the
steps on how to deploy Redmine on GlassFish and shows some screenshots
later. More
documentation is available in Redmine
Guide.
| ~/testbed/redmine >svn co http://redmine.rubyforge.org/svn/branches/0.7-stable redmine-0.7 |
| ~/testbed/redmine
>sudo mysqld_safe
--user root Starting mysqld daemon with databases from /usr/local/mysql/data |
| ~/testbed/redmine/redmine-0.7
>../jruby-1.1.1/bin/jruby
-S rake db:create (in /Users/arungupta/testbed/redmine/redmine-0.7) |
| ~/testbed/redmine/redmine-0.7
>../jruby-1.1.1/bin/jruby
-S rake db:migrate (in /Users/arungupta/testbed/redmine/redmine-0.7) == 1 Setup: migrating ========================================================= -- create_table("attachments", {:force=>true}) -> 0.2840s -- create_table("auth_sources", {:force=>true}) -> 0.0540s -- create_table("custom_fields", {:force=>true}) -> 0.0430s -- create_table("custom_fields_projects", {:id=>false, :force=>true}) -> 0.0080s -- create_table("custom_fields_trackers", {:id=>false, :force=>true}) -> 0.0500s . . . == 90 ChangeVersionsNameLimit: migrating ====================================== -- change_column(:versions, :name, :string, {:limit=>nil}) -> 0.0220s == 90 ChangeVersionsNameLimit: migrated (0.0220s) ============================= == 91 ChangeChangesetsRevisionToString: migrating ============================= -- change_column(:changesets, :revision, :string, {:null=>false}) -> 0.0210s == 91 ChangeChangesetsRevisionToString: migrated (0.0230s) ==================== == 92 ChangeChangesFromRevisionToString: migrating ============================ -- change_column(:changes, :from_revision, :string) -> 0.0130s == 92 ChangeChangesFromRevisionToString: migrated (0.0150s) =================== |
| JRUBY_HOME="/Users/arungupta/testbed/redmine/jruby-1.1.1" |
| ~/testbed/redmine
>./glassfishv3-tp2/glassfish/bin/asadmin
deploy redmine-0.7 Command deploy executed successfully. |
| May
21, 2008 4:58:30 PM com.sun.enterprise.rails.RailsDeployer
registerAdapter INFO: Loading application redmine-0.7 at /redmine-0.7 May 21, 2008 4:58:30 PM INFO: Starting Rails instances May 21, 2008 4:58:37 PM SEVERE: JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL May 21, 2008 4:58:42 PM com.sun.grizzly.jruby.RubyObjectPool$1 run INFO: Rails instance instantiation took : 11979ms May 21, 2008 4:58:42 PM com.sun.enterprise.v3.deployment.DeployCommand execute INFO: Deployment of redmine-0.7 done is 12091 ms |








Posted by Arun Gupta in web2.0 | Comments[18]
|
|
|
|
|
Monday May 19, 2008
Benefit of using JRuby-on-Rails: Using Java 2D power within Rails
One of the main advantages of using JRuby-on-Rails instead of
Ruby-on-Rails is to harness the power of Java libraries available in
the Java platform. The Java 2D
API is a set of classes for advanced 2D graphics and imaging,
and provides extensive support for image compositing and alpha channel
images, a set of classes to provide accurate color space definition and
conversion, and a rich set of display-oriented imaging operators.
Jennifer
published a new blog showing image-filtering effect (negative,
grayscale, brigthen, sharpen). Read the complete
entry.
A more comprehensive tutorial for JRuby-on-Rails on GlassFish
v3 TP2 (also Jennifer's work) is available here.
Technorati: rubyonrails
ruby jruby glassfish
v3
java2d
web2.0
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Sunday May 04, 2008
GlassFish v3 Gem 0.2.0 released
A newer version of GlassFish
v3 Gem for Ruby
on Rails is now available.
What's new ?
| ~/testbed/jruby-1.1.1
>bin/jruby -S gem
list glassfish *** LOCAL GEMS *** glassfish (0.1.2) |
| ~/testbed/jruby-1.1.1
>bin/jruby -S gem
uninstall
glassfish Successfully uninstalled glassfish-0.1.2-universal-java Remove executables: glassfish_rails, asadmin, asadmin.bat in addition to the gem? [Yn] y Removing glassfish_rails Removing asadmin Removing asadmin.bat |
| ~/testbed/jruby-1.1.1
>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.2.0-universal-java 1 gem installed |
Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Monday April 28, 2008
TOTD #32: Rails Deployment on GlassFish v3 from NetBeans IDE
Rails
powered by the GlassFish Application Server explains all the
benefits of using GlassFish for developing and deploying your Rails
applications. If you are using NetBeans
6.1 builds then you can deploy your Rails application
directly on GlassFish
v3 from within NetBeans
IDE. No longer you need
to have different development and deployment options.
This blog explains how to install a bleeding-edge GlassFish v3 plugin
and use it to deploy your Rails app natively on GlassFish (no WAR or
anything :). Let's get started! Note, this plugin is bleeding edge and
will soon be released on the Beta Update Center.












Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive is available here.
Technorati: totd glassfish v3 netbeans rubyonrailsPosted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
|
Monday April 14, 2008
Rails and Java EE integration - Native Rails on GlassFish v3
The last part of this tri-series blog (Part
1, Part
2) will show how a Rails application can be deployed on
GlassFish - without the need of Goldspike,
Warbler
or any other gem or plugin. Yes, that's a native Rails app deployment
on GlassFish v3.
GlassFish
v3 is next version of GlassFish v2 and the focus is
modularization, enablement of non-Java EE containers and modularity - download
b09.
Rails
powered by GlassFish provides all the details on why
GlassFish provides an industry-grade and functionally-rich Application
Server.
Now detailed steps:
|
~/testbed/jruby-1.1/samples/rails >../../bin/jruby -S rails
railsee3 create create app/controllers create app/helpers create app/models . . . create log/production.log create log/development.log create log/test.log |
| <!DOCTYPE
web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>HelloServlet</servlet-name> <servlet-class>server.HelloServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloServlet</servlet-name> <url-pattern>/hello</url-pattern> </servlet-mapping> </web-app> |
| <?xml
version="1.0" encoding="UTF-8"?> <!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software /appserver/dtds/sun-web-app_2_5-0.dtd"> <sun-web-app error-url=""> <context-root>/servlet</context-root> <class-loader delegate="true"/> </sun-web-app> |
| JRUBY_HOME="/Users/arungupta/testbed/jruby-1.1" |
| ~/testbed/jruby-1.1/samples/rails
>~/testbed/glassfish/v3/p2b9/glassfish/bin/asadmin
deploy --force=true railsee3 railsee3 deployed successfully Command deploy executed successfully. |


| ~/testbed/jruby-1.1/samples/rails/railsee3
>../../../bin/jruby
script/generate controller home index JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL exists app/controllers/ exists app/helpers/ create app/views/home exists test/functional/ create app/controllers/home_controller.rb create test/functional/home_controller_test.rb create app/helpers/home_helper.rb create app/views/home/index.html.erb |
| class
HomeController < ApplicationController include Java def index url = java.net.URL.new("http://localhost:8080/servlet/hello"); conn = url.open_connection; reader = java.io.BufferedReader.new(java.io.InputStreamReader.new(conn.get_input_stream)); @servlet_output = ""; input_line = reader.read_line; while input_line != nil @servlet_output << input_line; input_line = reader.read_line; end reader.close; end end |
| <h1>Home#index</h1> <p>Find me in app/views/home/index.html.erb</p> <%= @servlet_output %> |

Posted by Arun Gupta in web2.0 | Comments[15]
|
|
|
|
|
Today's Page Hits: 2662
Total # blog entries: 1009