1

我正在尝试将一个 ruby​​ 应用程序部署到我们的网络服务器,并与在那里运行的所有其他应用程序相适应。为此,我需要将其投入战争并与 Jetty 一起运行。

该应用程序已经在另一台机器上运行了一段时间,所以它的 gem 已经过时了,在更新它并转换到 JRuby 的过程中,我解决了一些旧的依赖项以让 warbler 捆绑它。Warbler 很好地捆绑了它,但部署的应用程序正在以未知的方式死亡。

这是我得到的堆栈跟踪:

--- System
jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.6.0_27-b27 [linux-amd64]
Time: 2013-08-07 09:13:33 -0400
Server: jetty/8.1.11.v20130520
jruby.home: file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home

--- Context Init Parameters:
public.root = /
rails.env = production

--- Backtrace
NoMethodError: undefined method `set_table_name' for LockableState(Table doesn't exist):Class
                          method_missing at org/jruby/RubyBasicObject.java:1696
                          method_missing at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activerecord-4.0.0/lib/active_record/dynamic_matchers.rb:22
                           LockableState at app/models/lockable_state.rb:3
                                  (root) at app/models/lockable_state.rb:1
                                    load at org/jruby/RubyKernel.java:1073
                                    load at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222
                         load_dependency at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213
                                    load at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:222
                                  (root) at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/app/models/lockable_state.rb:1
                                 require at org/jruby/RubyKernel.java:1054
                                 require at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228
                         load_dependency at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213
                                 require at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228
                         require_or_load at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:329
                               depend_on at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:288
                      require_dependency at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:206
                                  (root) at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/engine.rb:1
                                    each at org/jruby/RubyArray.java:1617
                             eager_load! at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/engine.rb:465
                                    each at org/jruby/RubyArray.java:1617
                             eager_load! at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/engine.rb:464
                             eager_load! at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/engine.rb:462
                                    each at org/jruby/RubyArray.java:1617
                             eager_load! at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/engine.rb:347
                           instance_exec at org/jruby/RubyBasicObject.java:1764
                                     run at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/initializable.rb:30
                                Finisher at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/application/finisher.rb:56
                        run_initializers at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/initializable.rb:55
                              tsort_each at jar:file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:150
  each_strongly_connected_component_from at jar:file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:219
       each_strongly_connected_component at jar:file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:183
                                    each at org/jruby/RubyArray.java:1617
       each_strongly_connected_component at jar:file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:182
       each_strongly_connected_component at jar:file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:180
                              tsort_each at jar:file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-stdlib-1.7.4.jar!/META-INF/jruby.home/lib/ruby/1.9/tsort.rb:148
                        run_initializers at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/initializable.rb:54
                                __send__ at org/jruby/RubyBasicObject.java:1703
                                    send at org/jruby/RubyKernel.java:2209
                             initialize! at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/application.rb:215
                                  (root) at config/environment.rb:5
                                    load at org/jruby/RubyKernel.java:1073
                          method_missing at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30
                                 require at org/jruby/RubyKernel.java:1054
                                  (root) at /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/config/environment.rb:1
                                  (root) at file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment3.rb:1
                        load_environment at file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/rails/environment3.rb:25

--- RubyGems
Gem.dir: /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems
Gem.path:
/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems
Activated gems:
  bundler-1.3.5
  rake-10.1.0
  CodeOfficer-rack-options-request-3.0.0
  i18n-0.6.4
  minitest-4.7.5
  multi_json-1.7.8
  atomic-1.1.12-java
  thread_safe-0.1.2-java
  tzinfo-0.3.37
  activesupport-4.0.0
  builder-3.1.4
  erubis-2.7.0
  rack-1.5.2
  rack-test-0.6.2
  actionpack-4.0.0
  mime-types-1.23
  polyglot-0.3.3
  treetop-1.4.14
  mail-2.5.4
  actionmailer-4.0.0
  activemodel-4.0.0
  activerecord-deprecated_finders-1.0.3
  arel-4.0.0
  activerecord-4.0.0
  activerecord-jdbc-adapter-1.2.9.1
  jdbc-mysql-5.1.25
  activerecord-jdbcmysql-adapter-1.2.9
  thor-0.18.1
  railties-4.0.0
  activerecord-session_store-0.0.1
  acts_as_list-0.2.0
  acts_as_tree-1.4.0
  exception_notification-4.0.0
  foreigner-1.4.2
  hike-1.2.3
  protected_attributes-1.0.3
  tilt-1.4.1
  sprockets-2.10.0
  sprockets-rails-2.0.0
  rails-4.0.0
  therubyrhino_jar-1.7.4
  therubyrhino-2.0.2
  will_paginate-3.0.4

--- Bundler
Bundler.bundle_path: /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems
Bundler.root: /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF
Gemfile: /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/Gemfile
Settings:
  gemfile = /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/Gemfile
  without = development:test:assets
  bin_path = /tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/WEB-INF/gems/gems/bundler-1.3.5/bin/bundle

--- JRuby-Rack Config
compat_version = 
default_logger = org.jruby.rack.logging.StandardOutLogger@1dfe3aa4
equals = <error: >
err = java.io.PrintStream@3dcb9af7
filter_adds_html = true
filter_verifies_resource = false
ignore_environment = false
initial_memory_buffer_size = 
initial_runtimes = 
jms_connection_factory = 
jms_jndi_properties = 
logger = org.jruby.rack.logging.ServletContextLogger@42f6b022
logger_class_name = servlet_context
logger_name = jruby.rack
maximum_memory_buffer_size = 
maximum_runtimes = 
num_initializer_threads = 
out = java.io.PrintStream@677afc95
rackup = 
rackup_path = 
rewindable = true
runtime_arguments = 
runtime_environment = 
runtime_timeout_seconds = 
serial_initialization = false
servlet_context = ServletContext@o.e.j.w.WebAppContext{/webstat,file:/tmp/jetty-0.0.0.0-8085-webstat.war-_webstat-any-/webapp/},/mfl/run/war/webstat.war
throw_init_exception = false
4

1 回答 1

0

set_table_name已在 Rails 4 中删除

相反,您应该使用

class LockableState < ActiveRecord::Base
  self.table_name = "locks"
end
于 2013-08-07T13:58:16.503 回答