The Source for Java Technology Collaboration
User: Password:



Arun Gupta

Arun Gupta's Blog

GlassFish v3 Gem Updated

Posted by arungupta on January 05, 2008 at 06:25 AM | Comments (1)

Pramod published an updated JRuby Gem for GlassFish v3. Download the gem here.

Here are the updates from last time:
  1. The Gem is now smaller - 2.4 MB instead of 2.9 MB (approx 20% smaller).
  2. The Gem is now using the latest v3 codebase, including Grizzly JRuby module 1.6.1.
  3. 2 Rails instances are created instead of the default one. So now 2 requests can be invoked in parallel and they both will be served instead of returning a blank page for the pending request. This explains/resolves the issue reported here.
  4. The list of known issues is now available

    1. #3856 - Default Rails page gives 404
    2. #3964 - Option to specify port at the command-line
    3. #3965 - Port conflict should be resolved transparently
    4. #3966 - Blank page returned if no Rails instance is available
    5. #3968 - Provide a means to configure number of Rails instances
    6. #3971 - Usage of v3 gem needs to be consistent with WEBrick

    Please file bugs if you see any other issues.
Ad of course, you can BYOG (Build Your Own Gem :)

Either way, once the Gem is installed then go ahead and use it as described below:
  1. Create a template app as:

    jruby -S rails hello
  2. Create a controller and view as:

    cd hello
    jruby script/generate controller say hello
  3. Edit controller as:

    vi app/controllers/say_controller.rb

    and add the following variable in hello helper method:

    @hello_string = "v3 Gem is getting polished!"
  4. Edit view as:

    vi app/views/say/hello.rhtml

    and add the following string at the bottom:

    <%= @hello_string %>
  5. Ad deploy the application on GlassFish v3 gem as:

    cd ..
    jruby -S glassfish_rails hello
That's it! The following output in the console confirms successful start of the Gem:

Jan 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 ms


The application is deployed at http://localhost:8080/hello/say/hello and shows the output as:

GlassFish v3 gem - Simple App output

And http://localhost:8080/hello is displayed in the browser as shown below:

Default Rails page with v3 gem

And you can try more advanced applications like Mephisto as described here.

Technorati: ruby jruby glassfish v3 gem


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment


  • OS was an environment of Windows XP, Vista, and JRuby1.0.3, and the executed result error occurred!

    D:\dev\jruby-1.0.3\bin>jruby -S glassfish_rails hello
    2008/01/07 22:50:21 com.sun.enterprise.v3.server.AppServerStartup run
    情報: Init service : com.sun.enterprise.v3.services.impl.CmdLineParamProcessor@a
    7c45e
    2008/01/07 22:50:21 com.sun.enterprise.v3.server.AppServerStartup run
    情報: Init service : com.sun.enterprise.v3.services.impl.LogManagerService@c9250
    7
    2008/01/07 22:50:21 com.sun.enterprise.v3.services.impl.DeploymentService postCo
    nstruct
    情報: Supported containers : web,jruby,phobos
    2008/01/07 22:50:21 com.sun.enterprise.v3.server.AppServerStartup run
    情報: Startup service : Deployment
    2008/01/07 22:50:21 com.sun.enterprise.v3.services.impl.GrizzlyAdapter postConst
    ruct
    情報: Listening on port 8080
    2008/01/07 22:50:22 com.sun.grizzly.standalone.StaticResourcesAdapter
    情報: New Servicing page from: D:\dev\jruby-1.0.3\bin\hello\public
    Exception in thread "pool-1-thread-1" D:/dev/jruby-1.0.3/lib/ruby/1.8/pathname.r
    b:420:in `realpath_rec': No such file or directory - /D: (Errno::ENOENT)
    from D:/dev/jruby-1.0.3/lib/ruby/1.8/pathname.rb:453:in `realpath'
    from D:/dev/jruby-1.0.3/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializ
    er.rb:495:in `set_root_path!'
    from D:/dev/jruby-1.0.3/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializ
    er.rb:460:in `initialize'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:40:in `new'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:40:in `run'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:40:in `run'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:11:in `boot!'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:109
    from /D:/dev/jruby-1.0.3/bin/hello/config/environment.rb:11:in `require'

    from /D:/dev/jruby-1.0.3/bin/hello/config/environment.rb:11
    from :1
    ...internal jruby stack elided...
    from org.jruby.Ruby.loadScript(Ruby.java:1210)
    from org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:53)
    from org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:307)
    from org.jruby.runtime.load.LoadService.require(LoadService.java:333)
    from com.sun.grizzly.jruby.RubyObjectPool.loadRubyLibraries(RubyObjectPo
    ol.java:168)
    from com.sun.grizzly.jruby.RubyObjectPool$1.run(RubyObjectPool.java:135)

    from java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolEx
    ecutor.java:885)
    from java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecut
    or.java:907)
    from java.lang.Thread.run(Thread.java:619)
    Exception in thread "pool-1-thread-2" D:/dev/jruby-1.0.3/lib/ruby/1.8/pathname.r
    b:420:in `realpath_rec': No such file or directory - /D: (Errno::ENOENT)
    from D:/dev/jruby-1.0.3/lib/ruby/1.8/pathname.rb:453:in `realpath'
    from D:/dev/jruby-1.0.3/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializ
    er.rb:495:in `set_root_path!'
    from D:/dev/jruby-1.0.3/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializ
    er.rb:460:in `initialize'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:40:in `new'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:40:in `run'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:40:in `run'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:11:in `boot!'
    from /D:/dev/jruby-1.0.3/bin/hello/config/boot.rb:109
    from /D:/dev/jruby-1.0.3/bin/hello/config/environment.rb:11:in `require'

    from /D:/dev/jruby-1.0.3/bin/hello/config/environment.rb:11
    from :1
    ...internal jruby stack elided...
    from org.jruby.Ruby.loadScript(Ruby.java:1210)
    from org.jruby.runtime.load.ExternalScript.load(ExternalScript.java:53)
    from org.jruby.runtime.load.LoadService.smartLoad(LoadService.java:307)
    from org.jruby.runtime.load.LoadService.require(LoadService.java:333)
    from com.sun.grizzly.jruby.RubyObjectPool.loadRubyLibraries(RubyObjectPo
    ol.java:168)
    from com.sun.grizzly.jruby.RubyObjectPool$1.run(RubyObjectPool.java:135)

    from java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolEx
    ecutor.java:885)
    from java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecut
    or.java:907)
    from java.lang.Thread.run(Thread.java:619)
    2008/01/07 22:50:23 com.sun.enterprise.v3.server.AppServerStartup run
    情報: Startup service : Application Loader
    2008/01/07 22:50:23 com.sun.enterprise.v3.server.AppServerStartup run
    情報: Startup service : Grizzly on port 8080
    2008/01/07 22:50:23 com.sun.enterprise.v3.server.AppServerStartup run
    情報: Glassfish v3 started in 1466 ms

    Posted by: kimtea on January 07, 2008 at 06:02 AM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds