Database-enabled RoR WAR on GlassFish
Posted by arungupta on May 17, 2007 at 10:47 AM EDT
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
to
production:
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', add
require '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.
Technorati: glassfish rubyonrails ror netbeans
Related Topics >>
Blog Links >>
- Login or register to post comments
- Printer-friendly version
- arungupta's blog
- 898 reads





