Arun Gupta, Miles to go ...

Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems.
« Previous page | Main

http://blogs.sun.com/arungupta/date/20080504 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 ?

  • Codebase aligned with GlassFish v3 Technology Preview 2
  • Previous version (0.1.2) had some packaging issues which increased the size but now it's back to sweet 2.8 Mb.
Check if previously installed by using the following command:

~/testbed/jruby-1.1.1 >bin/jruby -S gem list glassfish

*** LOCAL GEMS ***

glassfish (0.1.2)

If already installed (as indicated by the list of gems) then uinstall it using the following command:

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

And then install it again as:

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

Updating the gem is giving unpredictable results (mostly not updating) and will be investigated later.

Rails powered by the GlassFish Application Server explains why GlassFish is a better deployment option for Rails applications.

All the latest information about the gem can be found at GlassFish JRuby wiki or JRuby wiki.

Please use the gem and send us feedback on GlassFish forums, dev@glassfish or gem mailing list.

Technorati: rubyonrails jruby ruby glassfish v3 gem

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20080408 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:

  • Identical development and deployment environments
  • Handles multiple requests by maintaining JRuby runtimes and database connection pools
  • Ability to redploy an application without restarting container
  • In-built Clustering, Load Balancing, and High Availability support
  • Allows to leverage investment in a Java EE infrastructure and cohosting Ruby-on-Rails and Java EE applications
All the above mentioned reasons, and much more, are explained in detail in Rails powered by the GlassFish Application Server.

The gem installation is extremely simple as shown below:

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

After the gem is installed, get started by developing a simple scaffold application or Mephisto.

If you are attending JavaOne 2008, then LAB 8400 will show how to develop and deploy Rails applications using NetBeans and deploy them on GlassFish. LAB 4520 will teach you more about the modular and pluggable GlassFish v3 architecture.

GlassFish JRuby wiki or JRuby wiki gives you all the latest information about JRuby-on-Rails and GlassFish.

Technorati: jruby ruby rubyonrails netbeans glassfish v3 gem

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20080324 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:

  • 58 issues resolved since JRuby 1.1RC2
  • ri/rdoc w/ documentation included in distribution
  • More IO corner cases fixed (popen, reopen)
  • Several small bottlenecks fixed
This is your last chance to report any issues before JRuby 1.1 goes final. And I encourage you to try out GlassFish v3 Gem (ver 0.1.2) on this JRuby version and file any issues.

Why should you try ? Read in a detailed article - Rails powered by GlassFish Application Server.

The gem can be installed using the following command:

dhcp64-134-213-159:jruby-1.1RC3 arungupta$ 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 108 gems from http://gems.rubyforge.org
............................................................................................................
complete
Successfully installed glassfish-0.1.2-universal-java
1 gem installed

Previous entries showing code samples are tagged with v3+gem.

All the latest information about the gem can be found at GlassFish JRuby wiki or JRuby wiki.

Please use the gem and send us feedback on GlassFish forums, dev@glassfish or gem mailing list.

File issues in JIRA or RubyForge or GlassFish Issue Tracker.

Technorati: rubyonrails jruby ruby glassfish v3 gem

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20080313 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:

After #4228 fix, you can easily follow TOTD#28 to create a scaffold using Rails 2.0 and deploy it on GlassFish gem instead of WEBrick - works on JRuby 1.1 RC2.

You can verify if have 0.1.1 version by giving the command:
Macintosh-187:jruby-1.1RC2 arungupta$ bin/jruby -S gem list -d glassfish

*** LOCAL GEMS ***

glassfish (0.1.1)
    GlassFish V3 Application Server for JRuby
You can update to the most recent version by giving the command:

Macintosh-187:jruby-1.1RC2 arungupta$ 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 metadata for 634 gems from http://gems.rubyforge.org
.............................................................................................................................
.............................................................................................................................
.............................................................................................................................
.............................................................................................................................
.............................................................................................................................
.........
complete
Attempting remote update of glassfish
Successfully installed glassfish-0.1.2-universal-java
1 gem installed
Gems updated: glassfish

And then again verify using the following command:
Macintosh-187:jruby-1.1RC2 arungupta$ bin/jruby -S gem list -d glassfish

*** LOCAL GEMS ***

glassfish (0.1.2, 0.1.1)
    GlassFish V3 Application Server for JRuby

If you installed version 0.1.0 then you need to uninstall it and install the new version using the following commands:
bin/jruby -S gem uninstall GlassFish
bin/jruby -S gem install glassfish

All the latest information about the gem can be found at GlassFish JRuby wiki or JRuby wiki.

Please use the gem and send us feedback on GlassFish forums, dev@glassfish or gem mailing list.

File issues in JIRA or RubyForge or GlassFish Issue Tracker.

Technorati: glassfish v3 jruby ruby rubyonrails gem

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20080311 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:

  1. Install JRubyStack
    1. Download JRubyStack from here. Click on the installer to see:


       
    2. Clicking on "Next >" brings the following screen:



      Even though it shows "JRuby on Rails" component but it includes everything, including GlassFish v3 Gem & MySQL server, in it.
    3. Further in the installation process, change the database user name from default "jrubystack" to "root". Take all other defaults through out the installation process.
    4. After the installation is completed, the following program menu is added


       
  2. After the bundle is installed, it's ready to use - MySQL server is started, a default application is created in "C:\Users\Arun Gupta\BitNami JRubyStack projects\jrubystack" and hosted using GlassFish v3 gem at "http://localhost:3000". Here is the output shown in the console window started by JRubyStack:

    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 ms

Now 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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20080220 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.

  1. Download & Install JRuby 1.1 RC2.
  2. Install Rails using the following command:

    jruby -S gem install rails
  3. Create a new Rails app using the following command:

    cd samples; mkdir rails; cd rails
    jruby -S rails books -d mysql
  4. Start MySQL server in a different shell using the following command:

    sudo /usr/local/mysql/bin/mysqld_safe --console
  5. Creat the database using the following command:

    cd books
    jruby -S rake db:create

    This creates the database defined by RAILS_ENV (Development is default). Here are some other new database-related commands:

    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
  6. Generate a scaffold using the following command:

    jruby script/generate scaffold book title:string author:string isbn:string description:text


    The output of the command looks like:

          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 :books


    There is no need to create the model explicitly as was the case in previous version of Rails. This creates the "db/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
    end
  7. Create the database tables using the following command:

    jruby -S rake db:migrate
  8. Deploy the application on WEBrick using the following command:

    jruby script/server


    The application is now available at "http://localhost:3000/books" and looks like:

    Rails2 CRUD Blank Page
  9. Click on "New book" to see a page as shown below (with values entered):

    Rails2 CRUD New Entry
    Click on Create button. After 2 entries have been entered, it looks like as shown below:

    Rails 2 CRUD Multiple Entries
That's it, you've created  a simple Rails 2.0 CRUD application.

You can also deploy this application easily on GlassFish v3 gem. Just follow the instructions here and enjoy!

I'll post a follow up blog where this is much more simplifed using NetBeans 6.1 builds where JRuby 1.1 and Rails 2.0.2 are already integrated.

Technorati: totd ruby jruby rubyonrails rails2 scaffold crud netbeans glassfish v3 gem

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20080216 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:

  1. 260 issues resolved
  2. Large IO refactoring
  3. Less memory than previous release
    1. Control total number of JIT'd methods
    2. Support a JIT cache between runtimes to return permgen
    3. 50-70% reduction in generated methods
Here are the steps for quick verification on v3 gem ...
  1. Download JRuby 1.1 RC2
  2. Install Rails and create a simple Rails application as described in TOTD #24.
  3. Install GlassFish v3 gem using the command as shown below:

    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 installed
  4. And now the simple application can be easily deployed on GlassFish gem as:

    jruby -S glassfish_rails hello

    Notice this command needs to be given from the parent directory of the application. The Applcation environment is as shown below:

    JRuby 1.1 RC2 Application Environment

    and the application output looks like exactly as expected:

    JRuby 1.1 RC2 Application Output
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: jruby ruby rubyonrails glassfish v3 gem

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20080214 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

  1. The name of the gem is changed from "GlassFish" to "glassfish".
  2. The default port number is 3000.
  3. Applications are deployed at root context ("/"). So the default application is now deployed "http://localhost:3000/home/index" instead of "http://localhost:8080/temp/home/index".
And then there are some other improvements:
  1. The number of concurrent requests can now be set using a command-line argument (instead of "-J-Djruby.runtime"). So 2 Rails instances can be created using the following command:

    jruby -S glassfish_rails temp -n 2
  2. Rails instances are created in parallel to improve the startup time of the gem.
How to install it ?

If you installed 0.1.0 version of the gem, then you need to uninstall using the following command:

bin/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.bat


And then install the new gem using the following command:

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 installed


And for a fresh check out of JRuby trunk, here is the list of gems shown:

bin/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)


Read more details about the this newly released gem here.

All the latest information about the gem can be found at GlassFish JRuby wiki or JRuby wiki.

Please use the gem and send us feedback on GlassFish forums, dev@glassfish or gem mailing list.

File issues in JIRA or GlassFish Issue Tracker.

Technorati: ruby jruby glassfish v3 gem rubyforge rubyonrails

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20071119 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.

  1. Software pre-requisite
    1. Subversion client (for example Tigris)
    2. Maven 2.0.x
    3. JRuby 1.0.x (I used JRuby 1.0.2 and lets say installed in JRUBY_HOME).  Make sure JRUBY_HOME/bin is in your path.
  2. Build the Gem
    1. 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:

    2. Build the gem by giving the command:

      mvn install

      And success is achieved by seeing the following in the console:

      [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.
  3. Install the Gem
    1. Change to the directory where the Gem is available

      cd target\dependency\glassfish\pkg
    2. Install the Gem as:

      C:\testbed\ruby\jruby-1.0.2\bin\jruby -S gem install GlassFish-10.0.0-java.gem
      Successfully installed GlassFish, version 10.0.0

And 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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20071115 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:

  1. Install and Configure JRuby 1.0.2. The GlassFish v3 Gem does not work on Windows (JRUBY-1549) with JRuby 1.0.2 and you need to use the JRuby trunk workaround.
    1. Download and Unzip JRuby1.0.2 (lets say JRUBY_HOME).
    2. Include 'JRUBY_HOME/bin' in your environment PATH.
    3. Install Rails (with all dependencies) in JRuby installation by giving the command:

      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.5
    4. Install ActiveRecord-JDBC as shown below:

      C:\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.5
  2. Download and Install GlassFish V3 Gem.
  3. Install and Configure Database
    1. Download and install MySQL Community Server 5.0 (lets say MYSQL_HOME).
    2. Start MySQL database by giving the command 'mysqld-nt --user root --console' in MYSQL_HOME/bin directory on Windows or './bin/mysqld_safe' from MYSQL_HOME directory on Unix flavors.
    3. In a different shell window, create a database and grant privileges by giving the following commands:
       
      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;
      Bye
  4. Install and Configure Mephisto
    1. Download and Unzip Mephisto 0.7.3.
    2. Install Mephisto as described here. The two steps are summarized below for convenience:
      1. Copy 'MEPHISTO_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.
      2. Bootstrap the development database using the command:

        C:\testbed\mephisto-0.7.3>jruby -S rake db:bootstrap -J-DRAILS_ENV=development

        and that shows the following output in the console:

        (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/MephistoBlog
  5. Deploy Mephisto on GlassFish v3 Gem as shown below:

    C:\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 ms
  6. Mephisto is now deployed at http://localhost:8080/mephisto-0.7.3



    and shows the following output in GlassFish console:

    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]
  7. The exact same application can be easily deployed on WEBrick as shown below:

    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.png

This 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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20071109 Friday November 09, 2007

JRuby 1.0.2 released - Improved Windows experience and Rails 1.2.5 support

JRuby 1.0.2 was released last week.

A total of 99 issues were fixed but I'm particularly excited about JRUBY-1347, JRUBY-1350, JRUBY-1401 and JRUBY-1410. These are some issues that I faced (1347 here, 1350 here, 1401 here, 1410 here) on my primary development machine - Windows.

Here is the status report:

  • On Windows only, the latest Rails gem (1.2.5) is now working with stable release of JRuby (1.0.2 as of today).

  • On Windows only, GlassFish v3 gem does not work with JRuby 1.0.2 but works with the JRuby trunk (JRUBY-1549). The gem works correctly on Solaris and Mac.

  • JRuby 1.0.2 bundles will be available on GlassFish Update Center soon.

Now the details.

Here is the command sequence for creating and hosting a trivial Hello World on WEBrick:

  1. Install Rails

    C:\testbed\ruby\jruby-1.0.2>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.5

  2. Create a template application

    C:\workarea\samples\rails>\testbed\ruby\jruby-1.0.2\bin\jruby -S rails hello
     create
    create app/controllers
    create app/helpers
    create app/models
    create app/views/layouts
    create config/environments
    create components
    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/mocks/development
    create test/mocks/test
    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 public/.htaccess
    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/breakpointer
    create script/console
    create script/destroy
    create script/generate
    create script/performance/benchmarker
    create script/performance/profiler
    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/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

  3. Add a controller

    C:\workarea\samples\rails>cd hello

    C:\workarea\samples\rails\hello>\testbed\ruby\jruby-1.0.2\bin\jruby script\generate controller say hello
    exists app/controllers/
    exists app/helpers/
    create app/views/say
    exists test/functional/
    create app/controllers/say_controller.rb
    create test/functional/say_controller_test.rb
    create app/helpers/say_helper.rb
    create app/views/say/hello.rhtml

  4. Edit Controller

    C:\workarea\samples\rails\hello>vim app\controllers\say_controller.rb

    Add  @hello_string = "Hello from 1.0.2" in hello helper. The updated file looks like:

    class SayController < ApplicationController

      def hello
        @hello_string = "Hello from 1.0.2"
      end
    end

  5. Edit View

    C:\workarea\samples\rails\hello>vim app\views\say\hello.rhtml

    and add <%= @hello_string %> as the last line. The updated file looks like:

    <h1>Say#hello</h1>
    <p>Find me in app/views/say/hello.rhtml</p>
    <%= @hello_string %>

  6. Start WEBrick and view the page http://localhost:3000/say/hello in a browser window:

    C:\workarea\samples\rails\hello>\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-07 17:22:01] INFO WEBrick 1.3.1
    [2007-11-07 17:22:01] INFO ruby 1.8.5 (2007-11-01) [java]
    [2007-11-07 17:22:01] INFO WEBrick::HTTPServer#start: pid=11245030 port=3000
    127.0.0.1 - - [07/Nov/2007:17:22:38 PST] "GET /say/hello HTTP/1.1" 200 81
    - -> /say/hello

The GlassFish v3 Gem does not work with JRuby 1.0.2 (JRUBY-1549) on Windows. It works very well on Solaris and Mac. For Windows, you need to use the JRuby trunk (checkout and build):

After you've built the JRuby trunk, you can create a similar new application and run it on GlassFish v3 gem as:

  1. Download and Install the gem

    C:\workspaces\jruby-trunk>bin\jruby -S gem install glassfish-gem-10.0-SNAPSHOT.gem
    Successfully installed GlassFish, version 10.0.0

  2. Start GlassFish v3 and view the page http://localhost:8080/hello/say/hello:

    C:\workarea\samples\rails>\workspaces\jruby-trunk\bin\jruby -S glassfish_rails hello
    Nov 8, 2007 2:39:07 PM com.sun.enterprise.v3.services.impl.GrizzlyAdapter postConstruct
    INFO: Listening on port 8080
    Nov 8, 2007 2:39:08 PM com.sun.enterprise.v3.services.impl.DeploymentService postConstruct
    INFO: Supported containers : php,phobos,jruby,web
    Nov 8, 2007 2:39:08 PM com.sun.grizzly.standalone.StaticResourcesAdapter <init>
    INFO: New Servicing page from: C:\workarea\samples\rails\hello\public
    Nov 8, 2007 2:39:15 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 7588 ms
    Nov 8, 2007 2:39:27 PM sun.reflect.NativeMethodAccessorImpl invoke0
    INFO:

    Processing SayController#hello (for 127.0.0.1 at 2007-11-08 14:39:27) [GET]

    Nov 8, 2007 2:39:27 PM sun.reflect.NativeMethodAccessorImpl invoke0
    INFO: Session ID: 46e3279ab4f2d776b4d76010cc7b38af

    Nov 8, 2007 2:39:27 PM sun.reflect.NativeMethodAccessorImpl invoke0
    INFO: Parameters: {"action"=>"hello", "controller"=>"say"}

    Nov 8, 2007 2:39:27 PM sun.reflect.NativeMethodAccessorImpl invoke0
    INFO: Rendering say/hello

    Nov 8, 2007 2:39:27 PM sun.reflect.NativeMethodAccessorImpl invoke0
    INFO: Completed in 0.01100 (90 reqs/sec) | Rendering: 0.00900 (81%) | 200 OK [http://localhost/hello/say/hello]

A comprehensive list of JRuby on GlassFish documentation is available here.

Technorati: jrubyonglassfish jruby glassfish windows rubyonrails v3 gem ruby

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070914 Friday September 14, 2007

Announcing GlassFish Gem for Rails

Jerome has been working on GlassFish gem for Rails. Read the interesting discussion on dev@glassfish. This blog announces a technology preview of this gem and describes the steps to try it out.

  1. Download GlassFish Gem from here.

  2. If you already have JRuby on Rails configured, then skip this step. Otherwise you need to install JRuby on Rails.
    1. Download and Unzip JRuby 1.0.1 from here (lets say JRUBY_HOME).
    2. In JRUBY_HOME\bin directory, install Rails plugin using the following command:

      jruby -S gem install rails -y --no-rdoc --no-ri

      The output of the command looks like:

      Bulk updating Gem source index for: http://gems.rubyforge.org
      Successfully installed rails-1.2.3
      Successfully installed activesupport-1.4.2
      Successfully installed activerecord-1.15.3
      Successfully installed actionpack-1.13.3
      Successfully installed actionmailer-1.3.3
      Successfully installed actionwebservice-1.2.3

  3. Some platform specific changes listed below are required due to bugs in JRuby 1.0.1.
    1. Only on Windows
      1. Edit "JRUBY_HOME\bin\_jrubyvars.bat" and replace

        for /r "%JRUBY_HOME%\lib" %%i in (*.jar) do @call "%~dp0_jrubysetcp" %%i

        with

        for %%i in ("%JRUBY_HOME%\lib"\*.jar) do @call "%~dp0_jrubysetcp" %%i

        This change is required because "/r" switch causes the entire tree of the directory to be parsed instead of just including the JARs in JRUBY_HOME/lib directory. More details here. This is filed as bug #1347.
      2. The value of CLASSPATH environment variable increases exponentially with each execution of the gem. Then you start seeing the following error in your command shell:

        The input line is too long.
        :gotCP
        was unexpected at this time.


        This is a filed as bug #1350. A workaround is to start a new shell when you start seeing the error.
    2. Only on Macintosh: "JRUBY_HOME\bin\glassfish_rails" script executable permissions need to be set explicitly. This is filed as bug #1348.

  4. Install the GlassFish gem using the command:

    c:\Downloads>\jruby-1.0.1\bin\gem install glassfish-gem-10.0-SNAPSHOT.gem

    The output of the command looks like:

    Successfully installed GlassFish, version 10.0.0

    Notice, you need to invoke this command from the directory where the gem was downloaded.

  5. Create a new rails app using the following command:

    %JRUBY_HOME%\bin\jruby -S rails hello

    The output of the command looks like:

    create
    create app/controllers
    create app/helpers
    create app/models
    create app/views/layouts
    create config/environments
    create components
    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/mocks/development
    create test/mocks/test
    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 public/.htaccess
    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/breakpointer
    create script/console
    create script/destroy
    create script/generate
    create script/performance/benchmarker
    create script/performance/profiler
    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/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

  6. Start GlassFish for this newly created app using the following command:

    %JRUBY_HOME%\bin\jruby -S glassfish_rails hello

    You need to invoke the command from outside the application directory instead of the natural way (script\server start). This will be fixed in the future builds. The output of the command looks like:

    Sep 13, 2007 1:32:42 PM com.sun.enterprise.v3.services.impl.GrizzlyAdapter postConstruct
    INFO: Listening on port 8080
    Sep 13, 2007 1:32:42 PM com.sun.enterprise.v3.services.impl.DeploymentService postConstruct
    INFO: Supported containers : jruby,web,php,phobos
    Sep 13, 2007 1:32:43 PM com.sun.grizzly.standalone.StaticResourcesAdapter <init>
    INFO: New Servicing page from: C:\workarea\samples\rails\hello\public
    C:/jruby-1.0.1/lib/ruby/gems/1.8/gems/actionmailer-1.3.3/lib/action_mail
    er.rb:49 warning: already initialized constant MAX_LINE_LEN
    Sep 13, 2007 1:32:51 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: Glassfish v3 started in 8996 ms

  7. Now you can view the default GlassFish web page at "http://localhost:8080".

This verifies the basic installation of the GlassFish gem. Lets add a simple controller to our application.

  1. Add a controller to the application by changing to the directory "hello" and giving the command:

    jruby script\generate controller say hello

    The output of the command looks like:

    exists app/controllers/
    exists app/helpers/
    create app/views/say
    exists test/functional/
    create app/controllers/say_controller.rb
    create test/functional/say_controller_test.rb
    create app/helpers/say_helper.rb
    create app/views/say/hello.rhtml

  2. In hello\app\views\say directory, edit "hello.rhtml" such that it looks like:

    <h1>Say#hello</h1>
    <p>Find me in app/views/say/hello.rhtml</p>
    <%= @hello_string %>
  3. In hello\app\controllers directory, edit "say_controller.rb" such that it looks like:

    class SayController < ApplicationController
      def hello
        @hello_string = "Hello from Controller!"
      end
    end

  4. The page is now accessible at "http://localhost:8080/hello/say/hello".

This is hosted using GlassFish. Of course, the same application can be deployed on WEBrick by giving the command:

jruby script\server webrick start

Try your applications on GlasFish gem and let us know by leaving a comment on this blog or sending an email to users@glassfish or posting to GlassFish forum.

You can also download GlassFish V3 standalone builds from here. The instructions to deploy a Rails application on GlassFish V3 are available here and on V2 here.

Technorati: jruby ruby rubyonrails glassfish jrubyonglassfish gem v3

del.icio.us | furl | simpy | slashdot | technorati | digg |
|
« Previous page | Main

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.