UPDATE: Simplified steps for GlassFish V2 are available here and for V3 here.
Follow up from here.
In this post I’ll show how a Ruby-on-Rails (RoR) application, talking to MySQL database, can be deployed as a WAR file on GlassFish V2. Here are the steps I followed:
- Create a HelloWorld RoR app talking to MySQL database as described here.
- Expand NetBeans project, expand ‘
Configuration‘ and open ‘database.yml‘. Change production database entry from:production:
adapter: mysql
database: HelloWorld_production
username: root
password:
host: localhost
toproduction:
adapter: jdbc
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/helloworld_development
username: root
password:Notice, even though this is production setting we are using a "development" database.
- In ‘
Configuration‘, ‘environment.rb‘, addrequire 'jdbc_adapter'right before
Rails::Initializer.run do |config|On some platforms, this syntax has caused problems. In that case, it may alternatively be specified (step 9) as:
if RUBY_PLATFORM =~ /java/ require 'rubygems' RAILS_CONNECTION_ADAPTERS = %w(jdbc) end
- Recreate the WAR file by invoking the command ‘
rake war:standalone:create‘ from your application directory. - Drop this WAR file in "
domains/domain1/autodeploy" directory of your GlassFish instance and you are done!
With this, you’ve deployed a Ruby-on-Rails application accessing MySQL database as a WAR file on GlassFish V2.
Related posts:
[Trackback] Craig announced jMaki on Rails. Here I provide detailed steps to read data from a MySQL database and display it in a jMaki-wrapped Yahoo DataTable widget. Download NetBeans 6.0 M9 (Full version) and configured to install only "Base IDE", &quo…
Comment by Arun Gupta's Blog — May 17, 2007 @ 1:56 pm
[Trackback] Tim Bray, Web Guy from Sun Microsystems gave the keynote session at Rails Conf 2007 yesterday (May 19). With 1600 attendees, it was quite a different experience from JavaOne last week which had approx 16,000 people. The session was to…
Comment by Arun Gupta's Blog — May 20, 2007 @ 9:17 am
[Trackback] Based upon a user request, this is a follow up entry to show how jMaki on Rails For Dummies work on NetBeans 6 Milestone 10. Some of the steps are simplified and more details are provided. The updates from the…
Comment by Arun Gupta's Blog — July 23, 2007 @ 11:21 am
[Trackback] Get ready for an interactive afternoon of coding and discussion on JRuby and GlassFish on Aug 8th in San Francisco, CA. In this free event, JRuby on Rails: Power plus simplicity, learn how to code and deploy a JRuby…
Comment by Arun Gupta's Blog — August 7, 2007 @ 9:59 am
[Trackback] Earlier in a three-part series (part1, part2, part3) I showed how a JRuby application can be deployed on GlassFish. This screencast consolidates all the entries together and shows how such an application can be developed and deployed using NetBeans…
Comment by Arun Gupta's Blog — August 8, 2007 @ 9:46 am