透明思考


Transparent Thoughts


JRubyWorks- J2EE on Rails

(NOTE: JRubyWorks keeps moving forward and this article may not be up to date.)

How to run yourRailsapplication withJ2EEweb servers (such asJettyandTomcat)? Here’s a solution:

1. SetJRUBY_HOME environment variable properly.

export JRUBY_HOME=/usr/lib/jruby

2. InstallActiveRecord-JDBC.

jruby -S gem install ActiveRecord-JDBC -y

3. InstallJRubyWorksplugin.

script/plugin install \http://jrubyworks.rubyforge.org/svn/trunk/jrubyworks/

4. Configure your Rails application asthis article. JRubyWorksplugin includesmysql-connectorby default. If you use database other thanMySQL, you can putcorrespondingJDBCdriver in${RAILS_ROOT}/lib/javadirectory and JRubyWorks will take care of it conventionally.

5. Run your application and try it athttp://localhost:8080. Alsoyou can find aWARfile of your application in${RAILS_ROOT}/wardirectory. You can deploy it to otherJ2EEweb servers.

jruby -S rake retty

JRubyWorks is based onJRuby Rails Integrationand hope to make the integration easier. It’squite immature so far, apparently. Yourfeedbackand contribution will be very helpful and highly appreciated.