Question

I'm trying to deploy a ruby app to our webserver and to fit in with all the other apps that are running there. To do this, i need to toss it in to a war and run it with Jetty.

The app has been sitting on another machine for sometime so its gems are out of date, in the process of getting it updated and transitioned to JRuby I resolved a number of old dependencies to get warbler to bundle it. Warbler is bundling it just fine, but the deployed app is dying with unknown method.

This is the the stack trace i get:

--- 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
Was it helpful?

Solution

set_table_name has been removed in Rails 4

Instead, you should use

class LockableState < ActiveRecord::Base
  self.table_name = "locks"
end
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top