我们正在使用 Warbler 将我们的应用程序部署到 JBoss。服务器似乎可以正常启动,但是当向应用程序发送请求时,我们收到以下错误:
...
JRuby-Rack startup
No such file to load -- lib/mylib
....
如您所见,在尝试加载 mylib.jar 时,它似乎崩溃了,这是我们在 user.rb 类中使用的 Java 库。我已经检查了 mylib.jar 文件是否存在于 myapp/lib 目录中,以及它是否被 Warbler 成功打包(它位于 WEB-INF/lib/mylib.jar 中)。
请注意:在遇到此处详述的问题后,我将 JRuby-Rack 降级为 1.0.10 - NoMethodError: relative_url_root when deploying rails app on tomcat。所以也许这个问题与此有关?
我不知道发生了什么。有任何想法吗?
其他可能有用的细节:
Java Version: 1.6.0_22
JRuby Version: 1.6.5 (ruby-1.9.2-p136)
Ruby Language Level: 1.9
宝石文件:
gem 'rails', '3.1.1'
...
gem 'warbler'
gem 'jruby-rack', '1.0.10'
...
配置/warble.rb:
...
config.dirs = %w(app config lib log vendor tmp)
...
config.webxml.jruby.compat.version = "1.9"
...
应用程序/模型/user.rb:
require 'java'
require 'lib/mylib.jar'
...
全回溯:
...
14:53:49,552 INFO [Server] JBoss (MX MicroKernel) [4.3.0.GA_CP01 (build: SVNTag=JBPAPP_4_3_0_GA_CP01 date=200804211657)] Started in 28s:311ms
14:54:33,799 ERROR [STDERR] /usr/local/appserver/jboss4.3/server/ruby/tmp/deploy/tmp4492943940433390521myapp-exp.war/WEB-INF/gems/gems/rack-1.3.5/lib/rack.rb:14 warning: already initialized constant VERSION
14:54:37,614 ERROR [STDERR] /usr/local/appserver/jboss4.3/server/ruby/tmp/deploy/tmp4492943940433390521myapp-exp.war/WEB-INF/gems/gems/jruby-rack-1.0.10/lib/jruby/rack/version.rb:10 warning: already initialized constant VERSION
14:54:41,881 INFO [ContainerBase] Warning: no min runtimes specified.
14:54:41,888 INFO [ContainerBase] Warning: no max runtimes specified.
14:54:41,895 INFO [ContainerBase] An exception happened during JRuby-Rack startup
No such file to load -- lib/mylib
--- System
jruby 1.6.5 (ruby-1.9.2-p136) (2011-10-25 9dcd388) (Java HotSpot(TM) Server VM 1.6.0_22) [linux-i386-java]
Time: 2011-11-28 14:54:41 +0000
Server: JBossWeb/2.0.0.GA_CP05
jruby.home: file:/usr/local/appserver/jboss4.3/server/ruby/tmp/deploy/tmp4492943940433390521myapp-exp.war/WEB-INF/lib/jruby-stdlib-1.6.5.jar!/META-INF/jruby.home
--- Context Init Parameters:
com.sun.faces.injectionProvider = org.jboss.web.jsf.integration.injection.JBossInjectionProvider
jruby.compat.version = 1.9
public.root = /
rails.env = production
--- Backtrace
LoadError: No such file to load -- lib/mylib
...
“宝石列表”的输出:
$ gem list
*** LOCAL GEMS ***
actionmailer (3.1.1)
actionpack (3.1.1)
activemodel (3.1.1)
activerecord (3.1.1)
activeresource (3.1.1)
activesupport (3.1.1)
arel (2.2.1)
bouncy-castle-java (1.5.0146.1)
builder (3.0.0)
bundler (1.0.21)
capybara (1.1.2)
childprocess (0.2.3, 0.2.2)
ci_reporter (1.6.5)
coffee-rails (3.1.1)
coffee-script (2.2.0)
coffee-script-source (1.1.3)
cucumber (1.1.3)
cucumber-rails (1.2.0)
diff-lcs (1.1.3)
erubis (2.7.0)
execjs (1.2.9)
ffi (1.0.11 java)
gherkin (2.6.8 java)
haml (3.1.3)
haml-rails (0.3.4)
hike (1.2.1)
i18n (0.6.0)
jquery-rails (1.0.19, 1.0.18)
jruby-jars (1.6.5)
jruby-launcher (1.0.9 java)
jruby-openssl (0.7.4)
jruby-rack (1.0.10)
json (1.6.2, 1.6.1 java)
json_pure (1.6.2, 1.6.1)
mail (2.3.0)
mime-types (1.17.2)
multi_json (1.0.3)
nokogiri (1.5.0 java)
polyglot (0.3.3)
rack (1.3.5)
rack-cache (1.1)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rails (3.1.1)
railties (3.1.1)
rake (0.9.2.2, 0.8.7)
rcov (0.9.11 java)
rdoc (3.11)
rspec (2.7.0)
rspec-core (2.7.1)
rspec-expectations (2.7.0)
rspec-mocks (2.7.0)
rspec-rails (2.7.0)
rubyzip (0.9.5, 0.9.4)
sass (3.1.10)
sass-rails (3.1.5)
selenium-webdriver (2.13.0)
spork (0.9.0.rc9)
sprockets (2.0.3)
term-ansicolor (1.0.7)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
uglifier (1.1.0)
warbler (1.3.2)
xpath (0.1.4)