PDF: 164, PAPER: 146
Twitalytics is running fine on torquebox on my local machine. I’ve been through all of the steps to deploy to the vagrant box, and they are all completing successfully. However, when I deploy the application, for some reason it is not loading the analytics_util.rb file from the lib directory, which is causing an error:
01:00:54,505 ERROR [org.torquebox.messaging] (Thread-2 (HornetQ-client-global-threads-1339801924)) Unable to process inbound message: org.jruby.exceptions.RaiseException: (NameError) uninitialized constant Analytics::AnalyticsUtil
at org.jruby.RubyModule.const_missing(org/jruby/RubyModule.java:2642) [jruby.jar:]
at Module.const_missing(/opt/torquebox/jboss/standalone/tmp/vfs/deploymentcde565e6dade5e33/twitalytics.knob-7ddd9968a51a8669/vendor/bundle/jruby/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36) at org.jruby.RubyMethod.call(org/jruby/RubyMethod.java:133) [jruby.jar:]
at (Anonymous).calc_positivity_followers_r(/opt/torquebox-2.1.0/jboss/standalone/tmp/vfs/deploymentcde565e6dade5e33/twitalytics.knob-7ddd9968a51a8669/app/models/analytics.rb:25) at (Anonymous).refresh(/opt/torquebox-2.1.0/jboss/standalone/tmp/vfs/deploymentcde565e6dade5e33/twitalytics.knob-7ddd9968a51a8669/app/models/analytics.rb:14) at AnalyticsProcessor.on_message(/opt/torquebox-2.1.0/jboss/standalone/tmp/vfs/deploymentcde565e6dade5e33/twitalytics.knob-7ddd9968a51a8669/app/processors/analytics_processor.rb:20) at MessageProcessor.process!(/opt/torquebox/jruby/lib/ruby/gems/1.8/gems/torquebox-messaging-2.1.0-java/lib/torquebox/messaging/message_processor.rb:39) at ProcessorWrapper.process!(/opt/torquebox/jruby/lib/ruby/gems/1.8/gems/torquebox-messaging-2.1.0-java/lib/torquebox/messaging/processor_wrapper.rb:32) at org.jruby.RubyProc.call(org/jruby/RubyProc.java:270) [jruby.jar:]
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:220) [jruby.jar:]
Is there something about this deployment strategy or running in production that I have to do to get the classes in lib/ to autoload?
I tried replacing these lines in config/application.rb
config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += %W(#{config.root}/lib/assets)
config.autoload_paths += %W(#{config.root}/lib/tasks)
config.autoload_paths += %W(#{config.root}/lib/workers)
with this line:
config.autoload_paths += Dir["#{config.root}/lib/**/"]
Bu that made no difference.