我有一个简单的 Sinatra 应用程序,我将在 tomcat 中托管它作为战争。当我在tomcat中运行它并运行它时,一切正常。如果我在我的 warble 配置中设置 Ruby 1.9 标志
config.webxml.jruby.compat.version = "1.9"
然后战争没有运行,我在 tomcat 日志中收到此错误
INFO: An exception happened during JRuby-Rack startup
no such file to load -- mysinatraapp
--- System
jruby 1.6.5.1 (ruby-1.9.2-p136) (2011-12-27 1bf37c2) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_29) [darwin-x86_64-java]
Time: 2012-01-16 10:06:32 -0600
Server: Apache Tomcat/7.0.23
jruby.home: file:/apache-tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/jruby-stdlib-1.6.5.1.jar!/META-INF/jruby.home
--- Context Init Parameters:
jruby.compat.version = 1.9
jruby.max.runtimes = 1
jruby.min.runtimes = 1
public.root = /
rack.env = production
--- Backtrace
LoadError: no such file to load -- mysinatraapp
require at org/jruby/RubyKernel.java:1047
require at file:/apache-tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/jruby-stdlib-1.6.5.1.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
(root) at /apache-tomcat-7.0.23/webapps/ROOT/WEB-INF/config.ru:2
instance_eval at org/jruby/RubyBasicObject.java:1720
initialize at file:/apache-tomcat-7.0.23/webapps/ROOT/WEB-INF/lib/jruby-rack-1.1.3.jar!/vendor/rack-1.3.6/rack/builder.rb:51
(root) at /apache-tomcat-7.0.23/webapps/ROOT/WEB-INF/config.ru:1
mysinatraapp.rb 文件在战争中,所以我不明白为什么找不到它。该应用程序在 jruby 中从命令行运行时运行良好,所以我认为这不是我的代码和 1.9 的兼容性问题。即使只是从 web.xml 中删除这些行
<context-param>
<param-name>jruby.compat.version</param-name>
<param-value>1.9</param-value>
</context-param>
会让应用程序启动正常。
我的罐子的版本是 jruby-core-1.6.5.1.jar jruby-rack-1.1.3.jar jruby-stdlib-1.6.5.1.jar