2011-11-28 22 views
0

我們使用Warbler將應用程序部署到JBoss。服務器似乎開始罰款,但是當一個請求被髮送到我們得到以下錯誤的應用程序:使用Warbler和降級的JRuby-Rack時發出加載第三方JAR的問題?

... 
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 

的Gemfile:

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) 

回答

1

你怎麼樣需要你的罐子。

,如果它是

require 'lib/myjar' 

嘗試將其更改爲

require 'myjar' 

,並看看是否能工程

+0

是這個工作!所以它一定是試圖加載一個名爲'lib/mylib.jar'的jar文件,而不是名爲'lib'的目錄中名爲'mylib.jar'的jar文件。謝謝! – ryan