Hi all,
I’m trying to run a Ruby on Rails application in a Tomcat Java EE
container using the latest JRuby (1.1.4). First of all, my environment
is the following:
OS: Mac OS X 10.5.4 (Intel)
Java: Java™ 2 Runtime Environment, Standard Edition (build 1.5.0_13-
b05-237)
Java HotSpot™ Client VM (build 1.5.0_13-119, mixed mode, sharing)
Rails: 2.1.1 (latest!)
I use the latest version of warbler (0.9.11) to make a .war archive
for deployment in Tomcat. My config/environment.rb is customized with
the following soap4r calls:
require ‘rubygems’
gem ‘soap4r’
gem ‘fastercsv’
Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(FILE), ‘boot’)
Rails::Initializer.run do |config|
[ … configuration section skipped …]
puts ‘=> Booting Kernel…’
require File.join(File.dirname(FILE), ‘…’, ‘kernel’,
‘configurator’)
require File.join(File.dirname(FILE), ‘…’, ‘kernel’, ‘xmir_proxy’)
require File.join(File.dirname(FILE), ‘…’, ‘kernel’,
‘xmir_service’)
require File.join(File.dirname(FILE), ‘…’, ‘kernel’,
‘xmir_service_client’)
require File.join(File.dirname(FILE), ‘…’, ‘kernel’,
‘xmir_service_driver’)
require File.join(File.dirname(FILE), ‘…’, ‘kernel’,
'xmir_service_mapping_registr
configurator = Kernel::Configurator.instance
configurator.load_config
puts “=> Reading web app configuration from #{configurator.config_file}”
configurator.config.each do |xk, xv|
puts “section #{xk} {”
xv.each do |ik, iv|
puts " #{ik} = #{iv}"
end
puts “}”
end
xmir = Kernel::XmirProxy.new
begin
puts " identity = #{xmir.identify}"
puts " major version = #{xmir.major_version}"
puts " minor version = #{xmir.minor_version}"
puts “=> Boot OK”
rescue Exception => ex
puts “=> Caught error while testing the web service: #{ex}”
puts “=> Did you remember to start the web service?”
end
… where the XmirProxy is a proxy class that wraps the underlying
soap4r logic for doing XML-RPC to a remote server. environment.rb
checks the availability of the remote web service when booting the
application. This works absolutely brilliant in C Ruby. I have the
following jruby gems installed (as stated and checked by warbler):
actionmailer (2.1.1)
actionpack (2.1.1)
activerecord (2.1.1)
activerecord-jdbc-adapter (0.8.2)
activerecord-jdbcpostgresql-adapter (0.8.2)
activeresource (2.1.1)
activesupport (2.1.1)
fastercsv (1.2.3)
hoe (1.7.0)
httpclient (2.1.2)
jdbc-postgres (8.2)
jruby-openssl (0.3)
memcache-client (1.5.0)
rails (2.1.1)
rake (0.8.1)
rspec (1.1.4)
rubyforge (1.0.0)
soap4r (1.5.8)
sources (0.0.1)
warbler (0.9.11)
ZenTest (3.10.0)
When doing jruby -S warble war, I get the following exception
stacktrace: http://pastie.org/270258 (put into pastie for the sake of
reading…)
The war file is compressed, though, and I get the last following error
when deploying the war file afterwards in Tomcat:
Sep 11, 2008 12:26:33 AM org.apache.catalina.core.ApplicationContext log
SEVERE: Exception caught
org.jruby.rack.RackInitializationException: Could not find RubyGem
soap4r (>= 0)
from file:/Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/WEB-
INF/lib/jruby-comple
from file:/Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/WEB-
INF/lib/jruby-comple
from /Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/WEB-INF/
config/environment.rb
from /Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/WEB-INF/
config/environment.rb
from file:/Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/WEB-
INF/lib/jruby-rack-0
from file:/Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/WEB-
INF/lib/jruby-rack-0
from :3
from file:/Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/WEB-
INF/lib/jruby-rack-0
from file:/Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/WEB-
INF/lib/jruby-rack-0
from :3
at org.jruby.rack.DefaultRackApplicationFactory
$4.init(DefaultRackApplicationFactory.
at
org
.jruby
.rack
.DefaultRackApplicationFactory.getApplication(DefaultRackApplication
at
org
.jruby
.rack
.PoolingRackApplicationFactory.getApplication(PoolingRackApplication
at
org
.jruby.rack.DefaultRackDispatcher.process(DefaultRackDispatcher.java:31)
at org.jruby.rack.RackFilter.doFilter(RackFilter.java:51)
at
org
.apache
.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilter
at
org
.apache
.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.ja
at
org
.apache
.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233
at
org
.apache
.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191
at
org
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
128)
at
org
.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
102)
at
org
.apache
.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
286)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
845)
at org.apache.coyote.http11.Http11Protocol
$Http11ConnectionHandler.process(Http11Prot
at org.apache.tomcat.util.net.JIoEndpoint
$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:613)
Caused by: org.jruby.exceptions.RaiseException
at Kernel.raise(file:/Users/aj/jruby/apache-tomcat-6.0.18/webapps/
meeho/WEB-INF/lib/j
at #Class:01xf1b05c.report_activate_error(file:/Users/aj/jruby/
apache-tomcat-6.0.18
at #Class:01xf1b05c.activate(file:/Users/aj/jruby/apache-
tomcat-6.0.18/webapps/meeh
at Kernel.gem(/Users/aj/jruby/apache-tomcat-6.0.18/webapps/meeho/
WEB-INF/config/envir
at (unknown).(unknown)(/Users/aj/jruby/apache-tomcat-6.0.18/webapps/
meeho/WEB-INF/con
at Kernel.load(file:/Users/aj/jruby/apache-tomcat-6.0.18/webapps/
meeho/WEB-INF/lib/jr
at JRuby::Rack::RailsServletHelper.load_environment(file:/Users/aj/
jruby/apache-tomca
at #Class:01x34d2f7.new(:3)
at (unknown).(unknown)(file:/Users/aj/jruby/apache-tomcat-6.0.18/
webapps/meeho/WEB-IN
at Kernel.instance_eval(file:/Users/aj/jruby/apache-tomcat-6.0.18/
webapps/meeho/WEB-I
at Kernel.instance_eval(file:/Users/aj/jruby/apache-tomcat-6.0.18/
webapps/meeho/WEB-I
at Rack::Builder.initialize(:3)
at (unknown).(unknown)(:1)
soap4r is installed, but I think it might be related to the httpclient/
openssl problem when packing the application. This is getting really
odd.
I hope to hear from you guys soon, as I would really like to run my
current C/Ruby production environment on Java.
–
Mvh. / Best Regards
Anders Østergaard Jensen, B.Sc.
Partner & CTO, Meeho! ApS
Phone: +45 21 28 68 69
E-mail: [email protected]
Web: http://www.meeho.dk/