Error while loading java Class in Jruby application

…衆ロ難τιáo~ 提交于 2019-12-12 01:37:53

问题


I have deployed my Ruby on Rails Application on Torquebox. After starting server I am getting this error

    10:18:06,311 ERROR [org.torquebox.core.runtime] (Thread-95) Error during execution: ENV['RAILS_ROOT']=RACK_ROOT
ENV['RAILS_ENV']=RACK_ENV
require %q(org/torquebox/web/rails/boot)
: org.jruby.exceptions.RaiseException: (NameError) cannot load Java class sun.security.tools.KeyTool
        at org.jruby.javasupport.JavaClass.for_name(org/jruby/javasupport/JavaClass.java:1205) [jruby.jar:]
        at org.jruby.javasupport.JavaUtilities.get_proxy_class(org/jruby/javasupport/JavaUtilities.java:34) [jruby.jar:]
        at Object.java_import(/opt/torquebox/current/jruby/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/object.rb:46) at Module.Tomcat(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad_jars-1.0.3/lib/trinidad/jars.rb:20)        at (Anonymous).Trinidad(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad_jars-1.0.3/lib/trinidad/jars.rb:10)        at (Anonymous).(root)(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad_jars-1.0.3/lib/trinidad/jars.rb:5)    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
        at (Anonymous).(root)(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad_jars-1.0.3/lib/trinidad/jars.rb:10)  at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
        at Runtime.require(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad-1.3.5/lib/trinidad.rb:68)       at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1615) [jruby.jar:]
        at Runtime.require(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66) at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1615) [jruby.jar:]
        at Runtime.require(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55) at (Anonymous).require(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:119)     at (Anonymous).(root)(/usr/share/reposiotry/Purple-Hills/config/application.rb:18)      at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
        at (Anonymous).(root)(/usr/share/reposiotry/Purple-Hills/config/application.rb:2)       at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1058) [jruby.jar:]
        at (Anonymous).(root)(/usr/share/reposiotry/Purple-Hills/config/environment.rb:109)     at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
        at (Anonymous).(root)(file:/opt/torquebox/current/jboss/modules/org/torquebox/web/main/torquebox-web.jar!/org/torquebox/web/rails/boot.rb:3)
10:18:06,362 ERROR [org.torquebox.core.runtime] (Thread-95) Failed to initialize runtime: : org.jruby.exceptions.RaiseException: (NameError) cannot load Java class sun.security.tools.KeyTool
        at org.jruby.javasupport.JavaClass.for_name(org/jruby/javasupport/JavaClass.java:1205) [jruby.jar:]
        at org.jruby.javasupport.JavaUtilities.get_proxy_class(org/jruby/javasupport/JavaUtilities.java:34) [jruby.jar:]
        at Object.java_import(/opt/torquebox/current/jruby/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/object.rb:46) at Module.Tomcat(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad_jars-1.0.3/lib/trinidad/jars.rb:20)        at (Anonymous).Trinidad(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad_jars-1.0.3/lib/trinidad/jars.rb:10)        at (Anonymous).(root)(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad_jars-1.0.3/lib/trinidad/jars.rb:5)    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
        at (Anonymous).(root)(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad_jars-1.0.3/lib/trinidad/jars.rb:10)  at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
        at Runtime.require(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/trinidad-1.3.5/lib/trinidad.rb:68)       at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1615) [jruby.jar:]
        at Runtime.require(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66) at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1615) [jruby.jar:]
        at Runtime.require(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55) at (Anonymous).require(/opt/torquebox/current/jruby/lib/ruby/gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:119)     at (Anonymous).(root)(/usr/share/reposiotry/Purple-Hills/config/application.rb:18)      at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
        at (Anonymous).(root)(/usr/share/reposiotry/Purple-Hills/config/application.rb:2)       at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1058) [jruby.jar:]
        at (Anonymous).(root)(/usr/share/reposiotry/Purple-Hills/config/environment.rb:109)     at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1033) [jruby.jar:]
        at (Anonymous).(root)(file:/opt/torquebox/current/jboss/modules/org/torquebox/web/main/torquebox-web.jar!/org/torquebox/web/rails/boot.rb:3)
10:18:06,385 INFO  [org.torquebox.core.runtime] (Thread-95) Created ruby runtime (ruby_version: RUBY1_8, compile_mode: JIT, app: Purple-Hills, context: web) in 29.45s

回答1:


It looks like you have the trinidad gem in your Gemfile. That gem isn't needed under TorqueBox, and probably won't load properly. Try removing trinidad as a dependency and see if that helps. If not, come see us in irc (#torquebox on freenode) or on the mailing list and we'll give you a hand.



来源:https://stackoverflow.com/questions/11468973/error-while-loading-java-class-in-jruby-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!