Search |
||
Plug-in any Ruby/Rack based framework to GlassFishPosted by vivekp on April 3, 2009 at 10:33 PM PDT
GlassFish
gem as well as GlassFish
v3 supports Rack.
Rack provides an interface to plugin a Ruby web framework with a web sever.
Similar to Python WSGI.
This means that any ruby based framework that can talk Rack can be
simply deployed on GlassFish.
Here is how you can do it on GlassFish gem: Insall JRubyInstall JRuby from here. Setup JRUBY_HOME to the install location and add JRUBY_HOME/bin to your PATH.Install GlassFish gem$ gem install glassfish
Now, lets write a trivial app and save it in file: myapp.rb class MyAppWrite a rack-up script and save it in myframework.ru
That is pretty much your sample Ruby application and the Rack-up script to run on GlassFish. Above require 'rack/handler/grizzly' makes Grizzly handler available to Rack. To run it, simply run glassfish in side the directory where myapp.rb and myframework.ru are placed.
Now access, http://localhost:3000 in your browser to access your app.
If you are running GlassFish v3 server and want to deploy this app, you would simply use the same asadmin command from inside the application directory:
GlassFish gem as well as GlassFish v3 server can auto-detect Rails,
Merb and Sinatra applications. You can use the above mentioned
technique to plugin other frameworks. For reference also see Jacob's blog
where he explains how Sintra application is plugged in to GlassFish.»
Related Topics >>
Web Applications Comments
Comments are listed in date ascending order (oldest first)
Submitted by johnlloydjones on Sat, 2009-08-01 08:36.
I also get the uninitialized constant Rack::VERSION error. As far as I can see, this is because the jruby-rack.jar is not being found. Where should it be placed for the glassfish gem to use it?
Submitted by johnlloydjones on Sat, 2009-08-01 08:50.
OK, maybe not so simple. I added this to the top of my test.rb file:
module Rack
VERSION = '1.0'
end
Now I get this:
SEVERE: uninitialized constant JRuby::Rack
from :1
com.sun.grizzly.jruby.rack.RackInitializationException: uninitialized constant JRuby::Rack
from :1
at com.sun.grizzly.jruby.rack.DefaultRackApplicationFactory.createApplication(DefaultRackApplicationFactory.ja
va:169)
at com.sun.grizzly.jruby.rack.DefaultRackApplicationFactory.newApplication(DefaultRackApplicationFactory.java:
69)
Something is missing?
Submitted by johnlloydjones on Sat, 2009-08-01 09:16.
OK, success. I added this line to the .ru file:
require 'jruby/rack/grizzly_helper'
(Oh and I still need to define Rack::VERSION as above.)
Submitted by jamesbritt on Sun, 2009-07-19 12:15.
I've been tryig to get this working, but it fails right away with this:
SEVERE: uninitialized constant Rack::VERSION
Any idea why?
jruby 1.4.0dev (ruby 1.8.6p287) (2009-07-13 6586) (Java HotSpot(TM) Client VM 1.6.0_07) [i386-java]
glassfish (0.9.5), rack (1.0.0)
|
||
|
|