jruby / jruby

JRuby, an implementation of Ruby on the JVM
https://www.jruby.org
Other
3.79k stars 924 forks source link

Null pointer exception in Rails (devise) #4270

Closed francocorreasosa closed 7 years ago

francocorreasosa commented 7 years ago

Environment

Provide at least: JRuby version: jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d OpenJDK 64-Bit Server VM 25.111-b14 on 1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14 +jit [linux-amd64] OS: Linux 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

When it happens

It happens when it's deploying (capistrano) in the precompile_assets stage.

Error stack

LoadError: load error: /home/deploy/fastid/releases/20161108184750/app/models/software_admin -- java.lang.NullPointerException: null
  from org/jruby/RubyKernel.java:937:in `require'
  from active_support/dependencies.rb:293:in `block in require'
  from active_support/dependencies.rb:259:in `load_dependency'
  from active_support/dependencies.rb:293:in `require'
  from active_support/dependencies.rb:380:in `block in require_or_load'
  from active_support/dependencies.rb:37:in `block in load_interlock'
  from active_support/dependencies/interlock.rb:12:in `block in loading'
  from active_support/concurrency/share_lock.rb:117:in `exclusive'
  from active_support/dependencies/interlock.rb:11:in `loading'
  from active_support/dependencies.rb:37:in `load_interlock'
  from active_support/dependencies.rb:358:in `require_or_load'
  from active_support/dependencies.rb:511:in `load_missing_constant'
  from active_support/dependencies.rb:203:in `const_missing'
  from org/jruby/RubyModule.java:3152:in `const_get'
  from active_support/inflector/methods.rb:268:in `block in constantize'
  from org/jruby/RubyArray.java:1560:in `each'
  from org/jruby/RubyEnumerable.java:895:in `inject'
  from active_support/inflector/methods.rb:266:in `constantize'
  from active_support/dependencies.rb:583:in `get'
  from active_support/dependencies.rb:614:in `constantize'
  from devise.rb:301:in `get'
  from devise/mapping.rb:81:in `to'
  from devise/mapping.rb:76:in `modules'
  from devise/mapping.rb:93:in `routes'
  from devise/mapping.rb:160:in `default_used_route'
  from devise/mapping.rb:70:in `initialize'
  from devise.rb:331:in `add_mapping'
  from devise/rails/routes.rb:241:in `block in devise_for'
  from org/jruby/RubyArray.java:1560:in `each'
  from devise/rails/routes.rb:240:in `devise_for'
  from config/routes.rb:14:in `block in (root)'
  from org/jruby/RubyBasicObject.java:1670:in `instance_exec'
  from action_dispatch/routing/route_set.rb:389:in `eval_block'
  from action_dispatch/routing/route_set.rb:371:in `draw'
  from config/routes.rb:1:in `<top>'
  from org/jruby/RubyKernel.java:955:in `load'
  from active_support/dependencies.rb:1:in `block in (root)'
  from active_support/dependencies.rb:259:in `load_dependency'
  from active_support/dependencies.rb:287:in `load'
  from active_support/dependencies.rb:287:in `block in load'
  from org/jruby/RubyArray.java:1560:in `each'
  from rails/application/routes_reloader.rb:40:in `load_paths'
  from rails/application/routes_reloader.rb:40:in `load_paths'
  from rails/application/routes_reloader.rb:16:in `block in reload!'
  from org/jruby/RubyProc.java:318:in `call'
  from rails/application/routes_reloader.rb:26:in `updater'
  from active_support/file_update_checker.rb:77:in `execute'
  from rails/application/routes_reloader.rb:27:in `updater'
  from rails/application/routes_reloader.rb:7:in `block in execute_if_updated'
  from org/jruby/RubyBasicObject.java:1670:in `instance_exec'
  from rails/initializable.rb:30:in `run'
  from rails/application/finisher.rb:119:in `block in Finisher'
  from rails/initializable.rb:55:in `block in run_initializers'
  from tsort.rb:226:in `block in tsort_each'
  from tsort.rb:429:in `each_strongly_connected_component_from'
  from tsort.rb:348:in `block in each_strongly_connected_component'
  from org/jruby/RubyArray.java:1560:in `each'
  from org/jruby/RubyMethod.java:127:in `call'
  from tsort.rb:347:in `each_strongly_connected_component'
  from tsort.rb:345:in `each_strongly_connected_component'
  from tsort.rb:224:in `tsort_each'
  from tsort.rb:203:in `tsort_each'
  from rails/initializable.rb:54:in `run_initializers'
  from rails/application.rb:352:in `<top>'
  from org/jruby/RubyKernel.java:937:in `require'
  from active_support/dependencies.rb:293:in `block in require'
  from active_support/dependencies.rb:259:in `load_dependency'
  from active_support/dependencies.rb:293:in `require'
  from config/environment.rb:5:in `(root)'
  from rails/application.rb:1:in `block in (root)'
  from org/jruby/RubyProc.java:318:in `call'
  from rails/application.rb:328:in `block in require_environment!'
  from org/jruby/RubyArray.java:1560:in `each'
  from rails/application.rb:448:in `run_tasks_blocks'
  from rake/task.rb:248:in `block in execute'
  from rake/task.rb:243:in `execute'
  from rake/task.rb:187:in `invoke_with_call_chain'
  from monitor.rb:211:in `mon_synchronize'
  from rake/task.rb:180:in `block in invoke_with_call_chain'
  from org/jruby/RubyProc.java:318:in `call'
  from rake/task.rb:173:in `block in invoke'
  from org/jruby/RubyArray.java:1560:in `each'
  from sprockets/rails/task.rb:62:in `define'
  from rake/task.rb:248:in `block in execute'
  from rake/task.rb:243:in `execute'
  from rake/task.rb:187:in `invoke_with_call_chain'
  from monitor.rb:211:in `block in mon_synchronize'
  from org/jruby/RubyArray.java:1560:in `each'
  from rake/task.rb:180:in `invoke_with_call_chain'
  from rake/task.rb:209:in `block in invoke_prerequisites'
  from rake/task.rb:207:in `invoke_prerequisites'
  from rake/task.rb:186:in `invoke_with_call_chain'
  from monitor.rb:211:in `mon_synchronize'
  from rake/task.rb:180:in `invoke_with_call_chain'
  from rake/task.rb:173:in `block in invoke'
  from org/jruby/RubyArray.java:1560:in `each'
  from rake/application.rb:152:in `block in invoke_task'
  from rake/application.rb:108:in `top_level'
  from rake/application.rb:108:in `top_level'
  from rake/application.rb:117:in `block in run_with_threads'
  from rake/application.rb:102:in `top_level'
  from rake/application.rb:80:in `run'
  from rake/application.rb:178:in `<top>'
  from org/jruby/RubyKernel.java:955:in `load'
  from rake/application.rb:77:in `<top>'
  from org/jruby/RubyKernel.java:955:in `load'
  from /home/deploy/fastid/shared/bundle/jruby/2.2.0/gems/rake-11.3.0/exe/rake:27:in `(root)'
  from /home/deploy/fastid/shared/bundle/jruby/2.2.0/bin/rake:1:in `(root)'
  from /home/deploy/fastid/shared/bundle/jruby/2.2.0/bin/rake:23:in `(root)'
  from bundler/cli/exec.rb:1:in `(root)'
  from bundler/cli/exec.rb:74:in `kernel_load'
  from bundler/cli/exec.rb:27:in `run'
  from bundler/cli.rb:332:in `exec'
  from bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  from bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  from bundler/vendor/thor/lib/thor.rb:359:in `block in dispatch'
  from bundler/cli.rb:20:in `dispatch'
  from bundler/vendor/thor/lib/thor/base.rb:440:in `<top>'
  from org/jruby/RubyKernel.java:955:in `load'
  from /home/deploy/.rvm/gems/jruby-9.0.5.0/bin/bundle:23:in `<top>'

Gemfile content

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use Puma as the app server
gem 'puma', '~> 3.0'
# Use SCSS for stylesheets
gem 'patternfly-sass'
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem 'devise'
gem 'carrierwave'
gem 'countries'
gem 'country_select'
gem 'barby'
gem 'rqrcode'
gem 'will_paginate', '~> 3.1.0'
gem 'nprogress-rails'
gem 'toastr-rails'
gem 'wicked_pdf'
gem 'wkhtmltopdf-binary'
# Use postgres in production

# Use sentry to automatically report errors
gem 'sentry-raven'

# datatables support
gem 'jquery-datatables-rails'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
  gem 'capistrano',         require: false
  gem 'capistrano-rvm',     require: false
  gem 'capistrano-rails',   require: false
  gem 'capistrano-bundler', require: false
  gem 'capistrano3-puma',   require: false
  gem 'pg'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console'
  gem 'listen', '~> 3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :production do
  gem 'activerecord-jdbc-adapter', github: 'jruby/activerecord-jdbc-adapter', branch: 'rails-5'
  gem 'activerecord-jdbcpostgresql-adapter'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
headius commented 7 years ago

Thanks for the report!

  1. Please test a newer JRuby.
  2. If it still fails, pass -d to JRuby so we can see the wrapped NPE inside the LoadError.
headius commented 7 years ago

No response in a month, closing. Please re-open if you're still having problems.