Logstash filter plugin - Missing class name

Hi,

I am trying to convert a logstash 2.4 plugin to be compatible with 5.x. I made the necessary updates and when I run "rspec", I get the below error.

NameError: missing class name (`org.apache.logging.log4j.Level')
  get_proxy_or_package_under_package at org/jruby/javasupport/JavaUtilities.java:54
                  method_missing at file:/usr/local/rvm/rubies/jruby-1.7.26/lib/jruby.jar!/jruby/java/java_package_module_template.rb:14
                         Logging at /usr/local/rvm/gems/jruby-1.7.26/gems/logstash-core-5.2.1-java/lib/logstash/logging/logger.rb:6
                        LogStash at /usr/local/rvm/gems/jruby-1.7.26/gems/logstash-core-5.2.1-java/lib/logstash/logging/logger.rb:5
                          (root) at /usr/local/rvm/gems/jruby-1.7.26/gems/logstash-core-5.2.1-java/lib/logstash/logging/logger.rb:4
                         require at org/jruby/RubyKernel.java:1040
                          (root) at /usr/local/rvm/gems/jruby-1.7.26/gems/logstash-core-5.2.1-java/lib/logstash/logging.rb:1
                         require at org/jruby/RubyKernel.java:1040
                          (root) at /usr/local/rvm/gems/jruby-1.7.26/gems/logstash-core-5.2.1-java/lib/logstash/logging.rb:2
                         require at org/jruby/RubyKernel.java:1040
                          (root) at /usr/local/rvm/gems/jruby-1.7.26/gems/logstash-devutils-0.0.13-java/lib/logstash/devutils/rspec/spec_helper.rb:1
                         require at org/jruby/RubyKernel.java:1040
                          (root) at /usr/local/rvm/gems/jruby-1.7.26/gems/logstash-devutils-0.0.13-java/lib/logstash/devutils/rspec/spec_helper.rb:15
                            each at org/jruby/RubyArray.java:1613
                          (root) at /root/logstash-filter-geotag/spec/spec_helper.rb:1
                          (root) at /root/logstash-filter-geotag/spec/spec_helper.rb:1
                          (root) at /usr/local/rvm/gems/jruby-1.7.26/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:1
     setup_load_path_and_require at /usr/local/rvm/gems/jruby-1.7.26/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:867
     setup_load_path_and_require at /usr/local/rvm/gems/jruby-1.7.26/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:867

It appears that it is failing on a "java_import org.apache.logging.log4j.Level" line in the logging module.

The thing is, I can successfully run the tests in another plugin that was originally designed for LS5, but backported to 2.4.

What is causing this and how can I fix it?

Thanks,
Conall

Hello,
From the error, I believe the spec_helper in your project is missing a require.

Can you check if the first line in your spec_helper is this line? If its not can you add it?

require "logstash/devutils/rspec/spec_helper"

The other think I can think of is the dependency on the core is not correctly set, can you paste the content of your *.gemspec here?

Thanks

Hi @pierhugues,

That require was in fact missing, and it has fixed my issue.

Many thanks,
Conall