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]
|
|
|
|
|
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]
|
|
|
|
|
Tuesday April 08, 2008
JRuby 1.1 released - ready for production!
JRuby 1.1 is released
and ready for production use today. You can unleash the potential in 3
simple steps - download,
unzip & get
started. Here is a quote from the announcement:
more and more reports of
applications exceeding Ruby 1.8.6 performance; we are even beating Ruby
1.9 in some microbenchmarks
This is validated by 1
(Oct 2007), 2
(Nov 2007), 3
(Feb 2008), 4
(Feb 2008) and many other hidden/unknown reports. You can easily
configure JRuby 1.1 as the platform of your choice in NetBeans 6.1 as
described in TOTD
#27.
Now, match this blazing performance of JRuby with GlassFish
v3 gem (only 2.4 Mb) which provides a superior
solution for developing and deploying Rails application. The
main reasons for using GlassFish instead of WEBrick/Mongrel/LightTPD
are:
| ~/testbed/jruby-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 Updating metadata for 93 gems from http://gems.rubyforge.org ............................................................................................. complete Successfully installed glassfish-0.1.2-universal-java 1 gem installed |
Posted by Arun Gupta in web2.0 | Comments[2]
|
|
|
|
|
Monday March 24, 2008
JRuby 1.1 RC3 released - Last chance to file bugs
JRuby
1.1 RC3 (third and final release candidate) was released
last week. The highlights are:
dhcp64-134-213-159:jruby-1.1RC3
arungupta$ bin/jruby -S gem install glassfish |
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Thursday March 13, 2008
GlassFish v3 gem 0.1.2 released
Pramod announced the release of GlassFish
v3 Gem ver
0.1.2. The focus of this release is bugfixes:
Macintosh-187:jruby-1.1RC2
arungupta$ bin/jruby -S gem list
-d glassfish |
You can update to the most recent version by giving the command:Macintosh-187:jruby-1.1RC2
arungupta$ bin/jruby -S gem
update glassfish |
Macintosh-187:jruby-1.1RC2
arungupta$ bin/jruby -S gem list
-d glassfish |
bin/jruby
-S gem uninstall GlassFish |
Posted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
|
Tuesday March 11, 2008
BitNami's JRubyStack = JRuby + Rails + GlassFish Gem + MySQL all bundled together
BitNami provides easy-to-use, integrated and multiplatform install bundles for different open source apps. They released JRubyStack last week which includes JRuby 1.1 RC2, Rails 2.0.2, GlassFish v3 Gem 0.1.1, MySQL 5.0.45 and some other miscellaneous components. The components mentioned here are all you need to get started with hosting your JRuby-on-Rails applications on GlassFish. Refer to release notes for more details.
The steps below walks you through installation of JRubyStack. It shows how this stack provides an integrated and ready-to-use bundle for hosting your applications on GlassFish:



Mar 10, 2008 2:49:26 PM com.sun.enterprise.v3.server.AppServerStartup
run
INFO: Init service :
com.sun.enterprise.v3.services.impl.CmdLineParamProcessor@1d9e5ad
Mar 10, 2008 2:49:26 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Init service : com.sun.enterprise.v3.server.SystemTasks@33c3e6
Mar 10, 2008 2:49:26 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Init service :
com.sun.enterprise.v3.services.impl.LogManagerService@1b70f9e
Mar 10, 2008 2:49:26 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Init service : com.sun.enterprise.v3.services.impl.HouseKeeper@666d83
Mar 10, 2008 2:49:26 PM
com.sun.enterprise.v3.services.impl.DeploymentService postConstruct
INFO: Supported containers : web,jruby,phobos
Mar 10, 2008 2:49:26 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Startup service : Deployment
Mar 10, 2008 2:49:26 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Startup service :
org.glassfish.deployment.autodeploy.AutoDeployService@15925c0
Mar 10, 2008 2:49:27 PM com.sun.enterprise.v3.services.impl.GrizzlyAdapter
<init>
INFO: Listening on port 3000
Mar 10, 2008 2:49:27 PM com.sun.enterprise.v3.services.impl.GrizzlyAdapter
<init>
INFO: Listening on port 3131
Mar 10, 2008 2:49:27 PM com.sun.enterprise.v3.services.impl.GrizzlyAdapter
<init>
INFO: Listening on port 3838
Mar 10, 2008 2:49:27 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Startup service :
com.sun.enterprise.v3.services.impl.GrizzlyService@eccfe7
Mar 10, 2008 2:49:28 PM com.sun.grizzly.standalone.StaticResourcesAdapter
<init>
INFO: New Servicing page from: C:\Users\Arun Gupta\BitNami JRubyStack
projects\jrubystack\public
Mar 10, 2008 2:49:28 PM com.sun.enterprise.rails.RailsDeployer load
INFO: Loading application . at /
Starting Rails instances
Mar 10, 2008 2:49:58 PM com.sun.grizzly.jruby.RubyObjectPool$1 run
INFO: Rails instance instantiation took : 30451ms
Mar 10, 2008 2:49:58 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Startup service : Application Loader
Mar 10, 2008 2:49:58 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 32229 msNow you have a template app that can be used to experiment with different features of GlassFish Gem. A similar bundle can be easily hand-crafted using the steps described here.
More details about GlassFish and JRuby can be found @
GlassFish wiki
and JRuby wiki.
Help us test your application on the v3 gem and file issues in JIRA
or GlassFish
Issue Tracker.
Please use the gem and send us feedback on
GlassFish forums,
dev@glassfish or
gem mailing list.
Technorati: bitnami jrubystack jruby ruby rubyonrails glassfish v3 gem
Posted by Arun Gupta in web2.0 | Comments[0]
|
|
|
|
|
Wednesday February 20, 2008
TOTD #28: Getting Started with Rails 2.0 Scaffold
Rails
2.0 changes the way Scaffold
works. This blog walks you through the steps to create a simple CRUD
application using Scaffold in Rails 2.0.
jruby -S gem install railscd samples; mkdir rails; cd rails
jruby -S rails books -d mysqlsudo /usr/local/mysql/bin/mysqld_safe --consolecd books
jruby -S rake db:create
db:create:all |
Create all the databases (_Development, _Test, _Production) |
db:drop |
Drops your database |
db:reset |
Drop and Re-create your database, including migrations |
jruby script/generate scaffold book title:string author:string
isbn:string description:text
exists
app/models/
exists
app/controllers/
exists
app/helpers/
create
app/views/books
exists
app/views/layouts/
exists
test/functional/
exists
test/unit/
create
app/views/books/index.html.erb
create
app/views/books/show.html.erb
create
app/views/books/new.html.erb
create
app/views/books/edit.html.erb
create
app/views/layouts/books.html.erb
create
public/stylesheets/scaffold.css
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/book.rb
create test/unit/book_test.rb
create test/fixtures/books.yml
create db/migrate
create db/migrate/001_create_books.rb
create
app/controllers/books_controller.rb
create
test/functional/books_controller_test.rb
create
app/helpers/books_helper.rb
route
map.resources :booksdb/migrate/001_create_books.rb"
migration which looks like:class CreateBooks < ActiveRecord::Migration
def self.up
create_table :books do |t|
t.string :title
t.string :author
t.string :isbn
t.text :description
t.timestamps
end
end
def self.down
drop_table :books
end
endjruby -S rake db:migrate
jruby script/serverhttp://localhost:3000/books"
and looks like:


Posted by Arun Gupta in web2.0 | Comments[5]
|
|
|
|
|
Saturday February 16, 2008
GlassFish v3 gem on JRuby 1.1 RC2
JRuby 1.1 RC2 was released earlier
today an GlassFish
v3 gem works like a charm on it :)
Read the complete announcement here.
The key features of RC2 are:
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.1.1-universal-java
1 gem installedjruby -S glassfish_rails hello

Posted by Arun Gupta in web2.0 | Comments[2]
|
|
|
|
|
Thursday February 14, 2008
GlassFish v3 Gem - 0.1.1 available
Pramod released
an updated version 0.1.1 of the JRuby
GlassFish v3 gem.
What's New ? - Mainly
alignment with Rails convention
http://localhost:3000/home/index"
instead of "http://localhost:8080/temp/home/index".jruby -S glassfish_rails temp -n 2bin/jruby -S gem uninstall GlassFish
Successfully uninstalled GlassFish-0.1.0-java
Remove executables and scripts for
'glassfish_rails, asadmin, asadmin.bat' in addition to the gem?
[Yn] Y
Removing glassfish_rails
Removing asadmin
Removing asadmin.batbin/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.1.1-universal-java
1 gem installedbin/jruby -S gem list
*** LOCAL GEMS ***
actionmailer (2.0.2)
actionpack (2.0.2)
activerecord (2.0.2)
activeresource (2.0.2)
activesupport (2.0.2)
glassfish (0.1.1)
rails (2.0.2)
rake (0.8.1)
sources (0.0.1)Posted by Arun Gupta in web2.0 | Comments[7]
|
|
|
|
|
Friday February 08, 2008
GlassFish v3 Ruby Gem - New Home on RubyForge
![]() |
GlassFish v3 Gem allows JRuby-on-Rails application to be launched in GlassFish v3 server. It provides a robust alternative to WEBrick and Mongrel for development and deployment of your JRuby-on-Rails applications. |
-J-Djruby.runtime
as a command-line property (details below).bin/jruby -S gem install GlassFish
Need to update 24 gems from http://gems.rubyforge.org
........................
complete
Select which gem to install for your platform (java)
1. GlassFish 0.1.0 (java)
2. Skip this gem
3. Cancel installation
> 1
Successfully installed GlassFish-0.1.0-javaglassfish_rails"
script is available in JRUBY_HOME/bin
directory. The exact same commands work for installing the gem in JRuby
1.1RC1 as well.cd .. (go to parent directory of the application)
jruby -S glassfish_rails hellohttp://localhost:8080/hello/say/hello".-J-Djruby.runtime=NNN",
where NNN is
the number of expected concurrent requests. For example, if your
application needs to handle 4 concurrent requests then the command to
host your application will look like:jruby -J-Djruby.runtime=4 -S glassfish_rails hellohttp-listener-1", "http-listener-2"
and "admin-listener". jruby-1.0.3/lib/ruby/gems/1.8/gems/GlassFish-0.1.0-java/domains/domain1/config/domain.xml"
file. Search for the string in first column, replace the port attribute
of that XML element with the value in second column and the third
column shows the default value:| Search String | New Port | Default |
http-listener-1 |
8081 | 8080 |
http-listener-2 |
8182 | 8181 |
admin-listener |
4849 | 4848 |
-J-Djruby.rutime"
will be provided in
the near future.Posted by Arun Gupta in web2.0 | Comments[18]
|
|
|
|
|
Saturday January 05, 2008
Pramod published an updated JRuby
Gem for GlassFish v3. Download the gem here.
Here are the updates from last
time:
jruby -S rails hellocd hello
jruby script/generate controller say hellovi app/controllers/say_controller.rb @hello_string = "v3 Gem is getting polished!"vi app/views/say/hello.rhtml<%= @hello_string %>cd ..
jruby -S glassfish_rails helloJan 4, 2008 3:35:52 PM
com.sun.grizzly.standalone.StaticResourcesAdapter <init>
INFO: New Servicing page from:
/Users/arungupta/testbed/r126/jruby-1.0.3/bin/hello/public
Jan 4, 2008 3:36:00 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Startup service : Application Loader
Jan 4, 2008 3:36:00 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Startup service : Grizzly on port 8080
Jan 4, 2008 3:36:00 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 8567 mshttp://localhost:8080/hello/say/hello
and shows the output as:
http://localhost:8080/hello is displayed
in the browser as shown below:
Technorati: ruby jruby glassfish v3 gem
Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
Friday December 21, 2007
JRuby 1.0.3 + Rails 2.0 Hello World - Additional Steps Required
JRuby 1.0.3 was recently
released and so was Rails
2.0. I decided to try JRuby 1.0.3 + Rails 2.0 and realized
that a few additional steps (because of Rails 2.0) are required to get
a trivial Hello World
applcation up and running. Here are the steps:
~/samples/jruby arungupta$ jruby -S gem install rails
--include-dependencies --no-ri --no-rdoc
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-2.0.2
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.2jruby -S rails --database mysql hello or
jruby -S rails -d mysql hello--database mysql
otherwise Rails 2.0 uses sqlite3
as the default database.
cd hello
jruby script/generate controller say hellovi app/controllers/say_controller.rb@hello_string = ""vi app/views/say/hello.html.erb
<%= @hello_string %>.html.erb
instead of .rhtml.sudo ./bin/mysqld_safesudo ./bin/mysqladmin create hello_developmentjruby script/serverHello World
application is deployed using JRuby 1.0.3 + Rails 2.0 and displays the
output in a browser window as:
Posted by Arun Gupta in web2.0 | Comments[4]
|
|
|
|
|
Monday November 19, 2007
TOTD #18: How to Build The GlassFish v3 Gem for JRuby ?
Jerome posted the instructions to build GlassFish v3 Gem for JRuby - very simple and easy. A binary version of Gem is available here.
JRUBY_HOME). Make sure
JRUBY_HOME/bin is in your path.As explained in
Jerome's
entry, you can check out complete GlassFish v3 workspace or just the
Gem code. Here is how you'll check out only the Gem code on a Windows
machine using Tigris Subversion client:

And after the check out is complete, you'll see:

mvn install[INFO] (in
C:/workspaces/glassfish/gem/target/dependency/glassfish)
[WARNING] mkdir -p pkg
[INFO] Successfully built RubyGem
[INFO] Name: GlassFish
[WARNING] mv GlassFish-10.0.0-java.gem pkg/GlassFish-10.0.0-java.gem
[INFO] Version: 10.0.0
[INFO] File: GlassFish-10.0.0-java.gem
[INFO] [install:install]
[INFO] Installing
C:\workspaces\glassfish\gem\target\gem-10.0-SNAPSHOT.jar to C:\Users\Arun
Gupta\.m2\repository\org\glassfish\distributions\gem\10.0-SNAPSHOT\gem-10.0-SNAPSHOT.jar
[INFO] [install:install-file {execution: install-gem}]
[INFO] Installing
C:\workspaces\glassfish\gem\target\dependency\glassfish\pkg\GlassFish-10.0.0-java.gem
to C:\Users\Arun
Gupta\.m2\repository\org\glassfish\distributions\GlassFish-Gem\10.0-SNAPSHOT\GlassFish-Gem-10.0-SNAPSHOT.gem
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2 minutes 2 seconds
[INFO] Finished at: Fri Nov 16 17:56:12 PST 2007
[INFO] Final Memory: 11M/20M
[INFO]
------------------------------------------------------------------------
The Gem is available in target\dependency\glassfish\pkg
directory.cd target\dependency\glassfish\pkgC:\testbed\ruby\jruby-1.0.2\bin\jruby -S gem install
GlassFish-10.0.0-java.gem
Successfully installed GlassFish, version 10.0.0And use it!
Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.
Technorati: totd v3 jruby ruby rubyonrails glassfish gem jrubyonglassfish
Posted by Arun Gupta in Finance | Comments[2]
|
|
|
|
|
Thursday November 15, 2007
Mephisto with GlassFish v3 Gem
In an Earlier Post, I described how Mephisto (a popular web publishing system based on Ruby on Rails) can be deployed on GlassFish V3. Both JRuby and GlassFish has matured since then and this post will provide the updated instructions to deploy Mephisto using GlassFish v3 Gem.
Here are the exact steps:
JRUBY_HOME/bin' in your environment PATH.C:\workspaces\jruby-trunk>bin\jruby -S gem install rails
--include-dependencies --no-ri --no-rdoc
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-1.2.5
Successfully installed activesupport-1.4.4
Successfully installed activerecord-1.15.5
Successfully installed actionpack-1.13.5
Successfully installed actionmailer-1.3.5
Successfully installed actionwebservice-1.2.5C:\workspaces\jruby-trunk>bin\jruby -S gem install
activerecord-jdbc -y --no-rdoc --no-ri
Need to update 1 gems from http://gems.rubyforge.org
.
complete
Successfully installed ActiveRecord-JDBC-0.5mysqld-nt --user root --console'
in MYSQL_HOME/bin directory on Windows or './bin/mysqld_safe'
from MYSQL_HOME directory on Unix flavors.C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqladmin --u root
create mephisto_development
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45-community-nt MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> grant all on mephisto_development.* to arun@localhost identified
by 'noway';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
ByeMEPHISTO_HOME/config/database.example.yml'
to 'MEPHISTO_HOME/config/database.yml'. There is no need to
specify the JDBC adapter
ActiveRecord 0.5 onwards and that allows to use the default
database configuration file.C:\testbed\mephisto-0.7.3>jruby -S rake db:bootstrap -J-DRAILS_ENV=development
(in C:/testbed/mephisto-0.7.3)
mkdir -p C:/testbed/mephisto-0.7.3/config/../log
-- create_table("assets", {:force=>true})
-> 0.3330s
-- create_table("assigned_sections", {:force=>true})
-> 0.2000s
-- create_table("cached_pages", {:force=>true})
-> 0.2980s
-- create_table("content_versions", {:force=>true})
-> 0.2130s
-- create_table("contents", {:force=>true})
-> 0.2190s
-- create_table("events", {:force=>true})
-> 0.2680s
-- create_table("memberships", {:force=>true})
-> 0.1890s
-- create_table("sections", {:force=>true})
-> 0.1500s
-- create_table("sessions", {:force=>true})
-> 0.1200s
-- add_index("sessions", ["session_id"], {:name=>"sessions_session_id_index"})
-> 0.3220s
-- create_table("sites", {:force=>true})
-> 1.1240s
-- add_index("sites", ["host"], {:name=>"index_sites_on_host"})
-> 0.3490s
-- create_table("taggings", {:force=>true})
-> 0.1950s
-- create_table("tags", {:force=>true})
-> 0.1840s
-- create_table("users", {:force=>true})
-> 0.2750s
-- initialize_schema_information()
-> 0.2740s
-- columns("schema_info")
-> 0.0170s
copied default theme to C:/testbed/mephisto-0.7.3/config/../themes/site-1...
================================================================================
Thank you for trying out Mephisto 0.7.3: Noh-Varr Edition!
Now you can start the application with script/server, visit
http://mydomain.com/admin, and log in with admin / test.
For help, visit the following:
Official Mephisto Site - http://mephistoblog.com
The Mephisto Community Wiki - http://mephisto.stikipad.com/
The Mephisto Google Group - http://groups.google.com/group/MephistoBlogC:\testbed>\workspaces\jruby-trunk\bin\jruby -S glassfish_rails
mephisto-0.7.3
And that shows the following output in the console:
Nov 14, 2007 6:37:51 PM com.sun.enterprise.v3.services.impl.GrizzlyAdapter
postConstruct
INFO: Listening on port 8080
Nov 14, 2007 6:37:51 PM
com.sun.enterprise.v3.services.impl.DeploymentService postConstruct
INFO: Supported containers : php,phobos,jruby,web
Nov 14, 2007 6:37:52 PM com.sun.grizzly.standalone.StaticResourcesAdapter
<init>
INFO: New Servicing page from: C:\testbed\mephisto-0.7.3\public
Nov 14, 2007 6:38:00 PM com.sun.enterprise.v3.server.AppServerStartup run
INFO: Glassfish v3 started in 9054 mshttp://localhost:8080/mephisto-0.7.3

Nov 14, 2007 6:24:08 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO:
Processing MephistoController#dispatch (for 127.0.0.1 at 2007-11-14
18:24:08) [GET]
Nov 14, 2007 6:24:08 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Parameters: {"action"=>"dispatch", "controller"=>"mephisto",
"path"=>[]}
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mSQL (0.001000)←[0m ←[0;1mSET SQL_AUTO_IS_NULL=0←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mSite Columns (0.046000)←[0m ←[0mSHOW FIELDS FROM sites←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mSite Load (0.010000)←[0m ←[0;1mSELECT * FROM sites WHERE (sites.`host`
= 'localhost') LIMIT 1←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mSite Load (0.017000)←[0m ←[0mSELECT * FROM sites ORDER BY id
LIMIT 1←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mSection Columns (0.010000)←[0m ←[0;1mSHOW FIELDS FROM
sections←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mSection Load (0.005000)←[0m ←[0mSELECT * FROM sections WHERE
(sections.site_id =1) AND (sections.`path` = '') LIMIT 1←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mArticle Columns (0.024000)←[0m ←[0;1mSHOW FIELDS FROM
contents←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mUser Columns (0.013000)←[0m ←[0mSHOW FIELDS FROM users←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mArticle Load Including Associations (0.027000)←[0m
←[0;1mSELECT contents.`id` AS t0_r0, contents.`article_id` AS t0_r1,
contents.`user_id` AS t0_r2, contents.`title` AS t0_r3, contents.`permalink`
AS t0_r4, contents.`excerpt` AS t0_r5, contents.`body` AS t0_r6,
contents.`excerpt_html` AS t0_r7, contents.`body_html` AS t0_r8,
contents.`created_at` AS t0_r9, contents.`updated_at` AS t0_r10,
contents.`published_at` AS t0_r11, contents.`type` AS t0_r12,
contents.`author` AS t0_r13, contents.`author_url` AS t0_r14,
contents.`author_email` AS t0_r15, contents.`author_ip` AS t0_r16,
contents.`comments_count` AS t0_r17, contents.`updater_id` AS t0_r18,
contents.`version` AS t0_r19, contents.`site_id` AS t0_r20,
contents.`approved` AS t0_r21, contents.`comment_age` AS t0_r22,
contents.`filter` AS t0_r23, contents.`user_agent` AS t0_r24,
contents.`referrer` AS t0_r25, users.`id` AS t1_r0, users.`login` AS t1_r1,
users.`email` AS t1_r2, users.`crypted_password` AS t1_r3, users.`salt` AS
t1_r4, users.`activation_code` AS t1_r5, users.`activated_at` AS t1_r6,
users.`created_at` AS t1_r7, users.`updated_at` AS t1_r8, users.`deleted_at`
AS t1_r9, users.`token` AS t1_r10, users.`token_expires_at` AS t1_r11,
users.`filter` AS t1_r12, users.`admin` AS t1_r13 FROM contents LEFT O
UTER JOIN users ON users.id = contents.user_id INNER JOIN assigned_sections
ON contents.id = assigned_sections.article_id WHERE ((assigned_sections.section_id
= 1)) AND (contents.published_at <= '2007-11-15 02:24:09' AND
contents.published_at IS NOT NULL) AND ( (contents.`type` = 'Article' ) )
ORDER BY contents.published_at desc LIMIT 15←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;35;1mSection Load (0.009000)←[0m ←[0mSELECT * FROM sections WHERE
(sections.site_id =1) ORDER BY position←[0m
Nov 14, 2007 6:24:09 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Completed in 1.12200 (0 reqs/sec) | Rendering: 0.00100 (0%) | DB:
0.16200 (14%) | 200 OK [http://localhost/mephisto-0.7.3]
Nov 14, 2007 6:24:11 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO:
Processing AssetsController#show (for 127.0.0.1 at 2007-11-14 18:24:11)
[GET]
Nov 14, 2007 6:24:11 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: Parameters: {"ext"=>"css", "dir"=>"stylesheets", "action"=>"show",
"controller"=>"assets", "path"=>"main"}
Nov 14, 2007 6:24:11 PM sun.reflect.NativeMethodAccessorImpl invoke0
INFO: ←[4;36;1mSite Columns (0.030000)←[0m ←[0;1mSHOW FIELDS FROM sites←[0m
Nov 14, 2007 6:24:11 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;35;1mSite Load (0.018000)←[0m ←[0mSELECT * FROM sites WHERE (sites.`host`
= 'localhost') LIMIT 1←[0m
Nov 14, 2007 6:24:11 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;36;1mSite Load (0.011000)←[0m ←[0;1mSELECT * FROM sites ORDER BY
id LIMIT 1←[0m
Nov 14, 2007 6:24:12 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: Completed in 0.33500 (2 reqs/sec) | Rendering: 0.00100 (0%) | DB:
0.05900 (17%) | 200 OK [http://localhost/mephisto-0.7.3/stylesheets/main.css]
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO:
Processing AssetsController#show (for 127.0.0.1 at 2007-11-14 18:24:14)
[GET]
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: Parameters: {"ext"=>"png", "dir"=>"images", "action"=>"show",
"controller"=>"assets", "path"=>"bg"}
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;35;1mSite Columns (0.009000)←[0m ←[0mSHOW FIELDS FROM sites←[0m
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;36;1mSite Load (0.017000)←[0m ←[0;1mSELECT * FROM sites WHERE (sites.`host`
= 'localhost') LIMIT 1←[0m
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: ←[4;35;1mSite Load (0.007000)←[0m ←[0mSELECT * FROM sites ORDER BY id
LIMIT 1←[0m
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: Sending data bg.png
Nov 14, 2007 6:24:14 PM sun.reflect.GeneratedMethodAccessor5 invoke
INFO: Completed in 0.27900 (3 reqs/sec) | Rendering: 0.00000 (0%) | DB:
0.03300 (11%) | 200 OK [http://localhost/mephisto-0.7.3/images/bg.png]C:\testbed\mephisto-0.7.3>\testbed\ruby\jruby-1.0.2\bin\jruby
script\server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-11-14 18:17:57] INFO WEBrick 1.3.1
[2007-11-14 18:17:57] INFO ruby 1.8.5 (2007-11-01) [java]
[2007-11-14 18:17:58] INFO WEBrick::HTTPServer#start: pid=11245030 port=3000
127.0.0.1 - - [14/Nov/2007:18:18:11 PST] "GET / HTTP/1.1" 200 1326
In this case, Mephisto gets deployed at http://localhost:3000
and WEBrick console shows the following:
- -> /
127.0.0.1 - - [14/Nov/2007:18:18:14 PST] "GET /stylesheets/main.css
HTTP/1.1" 200 3168
http://localhost:3000/ -> /stylesheets/main.css
127.0.0.1 - - [14/Nov/2007:18:18:17 PST] "GET /favicon.ico HTTP/1.1" 200 0
- -> /favicon.ico
127.0.0.1 - - [14/Nov/2007:18:18:16 PST] "GET /images/bg.png HTTP/1.1" 200
142
http://localhost:3000/stylesheets/main.css -> /images/bg.pngThis shows how a popular Ruby application can be deployed on WEBrick or GlassFish V3 Gem without any change.
Let us know if you have tried other Rails applications on GlassFish v3 by leaving a comment.
Technorati: glassfish mephisto rubyonrails ror jrubyonglassfish v3 gem ruby jruby
Posted by Arun Gupta in web2.0 | Comments[3]
|
|
|
|
|
Today's Page Hits: 4584
Total # blog entries: 1007
| « December 2009 | ||||||
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
5 | ||||||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 | ||
| Today | ||||||