I recently successfully deployed a Ruby on Rails app running on jruby that uses ActiveRecord-JDBC adapter to talk to Oracle 10g database to run on JBoss 4.2.1. I used warbler plugin from Nick Seiger to convert the rails app to war file. I basically followed the instructions at this article about warbler (http://blog.nicksieger.com
There were a few quirks during this process which are listed below and hopefully these will be helpful to those trying to do the same. Theoretically this should work on any J2EE compliant app server or even Servlet containers.
- I had to uncomment the following line in warble.rb (warbler config file)
and change it to
config.gems = ["rails", "ActiveRecord-JDBC"]
This packages rails and ActiveRecord-JDBC gems in the war file.
- To use ActiveRecord-JDBC adapter you need to add the following code to environment.rb file
if RUBY_PLATFORM =~ /java/
require 'rubygems'
gem 'ActiveRecord-JDBC
require 'jdbc_adapter'
end
You need to be careful about where in that file you add these lines. They must be added before the line
Rails::Initializer.run do |config|
- This one should be obvious but you need to add the jdbc driver jar to JBoss lib folder. Since I used the default configuration in Jboss I added it to C:\opt\jboss-4.2.1.GA\server\default\lib folder.