JRuby applications in glassfish

I developed a few projects in Ruby on Rails so far. Now I noticed, that with the new glassfish v2 open source application server from sun, it is possible to load specially prepared RoR applications directly into a glassfish web container.

To develop my RoR applications I’m using the new Netbeans 6.0 IDE. They built an RoR only IDE which is available here.
To deploy a war file one needs to install a plugin for RoR to add a rake task which builds the war file. The plugin is named goldbrick. It can easaly be installed by adding “http://jruby-extras.rubyforge.org/svn/trunk/rails-integration/plugins/” to your plugin repositories.

After installing the goldbrick plugin and refreshing your list of rake tasks, you can build a war file by running rake war:standalone:create .
This will build a .war file in the projects top folder.

You can now easily deploy this application to glassfish by copying the .war file to your autodeploy folder. (eg. /opt/glassfish/domains/domain1/autodeploy).

If you now point your web browser to localhost:8080/<railsprojectname> , your rails project page should fire up.

I’m going to write soon about how to use the jdbc adapter for activerecord to access your MySQL database from within your rails application on your glassfish server.



No Comment

Leave a Reply

You must be