Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test fails with JDK17. #98

Closed
mashhurs opened this issue Feb 28, 2022 · 2 comments
Closed

Unit test fails with JDK17. #98

mashhurs opened this issue Feb 28, 2022 · 2 comments
Assignees
Labels

Comments

@mashhurs
Copy link
Contributor

Logstash information:

Please include the following information:

  1. Logstash version (e.g. bin/logstash --version)
  2. Logstash installation source (e.g. built from source, with a package manager: DEB/RPM, expanded from tar or zip archive, docker)
  3. How is Logstash being run (e.g. as a service/service manager: systemd, upstart, etc. Via command line, docker/kubernetes)
  4. How was the Logstash Plugin installed

JVM (e.g. java -version): JDK17

If the affected version of Logstash is 7.9 (or earlier), or if it is NOT using the bundled JDK or using the 'no-jdk' version in 7.10 (or higher), please provide the following information:

  1. JVM version (java -version)
  2. JVM installation source (e.g. from the Operating System's package manager, from source, etc).
  3. Value of the JAVA_HOME environment variable if set.

OS version (uname -a if on a Unix-like system): MacOS Monterey

Description of the problem including expected versus actual behavior: should pass all tests when using Java 17. However, the below errors (refer to the logs) occurred.

Steps to reproduce:

  1. Install JDk17
  2. Go to the logstash-filter-kv plugin directory
  3. Run either bundle exec rspec or jruby -rbundler/setup -S rspec -fd spec/filters/kv_spec.rb command to run the unit tests.

Provide logs (if relevant):

When running with bundle exec rspec

java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0xa84b6de) cannot access class com.sun.tools.javac.parser.Tokens$TokenKind (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module @0xa84b6de
	at com.google.googlejavaformat.java.JavaInput.buildToks(com/google/googlejavaformat/java/JavaInput.java:349)
	at com.google.googlejavaformat.java.JavaInput.buildToks(com/google/googlejavaformat/java/JavaInput.java:334)
	at com.google.googlejavaformat.java.JavaInput.<init>(com/google/googlejavaformat/java/JavaInput.java:276)
	at com.google.googlejavaformat.java.Formatter.getFormatReplacements(com/google/googlejavaformat/java/Formatter.java:280)
	at com.google.googlejavaformat.java.Formatter.formatSource(com/google/googlejavaformat/java/Formatter.java:267)
	at com.google.googlejavaformat.java.Formatter.formatSource(com/google/googlejavaformat/java/Formatter.java:233)
	at org.logstash.config.ir.compiler.ComputeStepSyntaxElement.generateCode(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:174)
	at org.logstash.config.ir.compiler.ComputeStepSyntaxElement.<init>(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:118)
	at org.logstash.config.ir.compiler.ComputeStepSyntaxElement.create(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:89)
	at org.logstash.config.ir.compiler.DatasetCompiler.prepare(org/logstash/config/ir/compiler/DatasetCompiler.java:321)
	at org.logstash.config.ir.compiler.DatasetCompiler.filterDataset(org/logstash/config/ir/compiler/DatasetCompiler.java:133)
	at org.logstash.config.ir.CompiledPipeline$CompiledExecution.filterDataset(org/logstash/config/ir/CompiledPipeline.java:417)
	at org.logstash.config.ir.CompiledPipeline$CompiledExecution.lambda$compileDependencies$6(org/logstash/config/ir/CompiledPipeline.java:523)
	at java.util.stream.ReferencePipeline$3$1.accept(java/util/stream/ReferencePipeline.java:197)
	at java.util.stream.ReferencePipeline$2$1.accept(java/util/stream/ReferencePipeline.java:179)
	at java.util.stream.ReferencePipeline$3$1.accept(java/util/stream/ReferencePipeline.java:197)
	at java.util.Iterator.forEachRemaining(java/util/Iterator.java:133)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(java/util/Spliterators.java:1845)
	at java.util.stream.AbstractPipeline.copyInto(java/util/stream/AbstractPipeline.java:509)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(java/util/stream/AbstractPipeline.java:499)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java/util/stream/ReduceOps.java:921)
	at java.util.stream.AbstractPipeline.evaluate(java/util/stream/AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(java/util/stream/ReferencePipeline.java:682)
	at org.logstash.config.ir.CompiledPipeline$CompiledExecution.compileDependencies(org/logstash/config/ir/CompiledPipeline.java:546)
	at org.logstash.config.ir.CompiledPipeline$CompiledExecution.flatten(org/logstash/config/ir/CompiledPipeline.java:500)
	at org.logstash.config.ir.CompiledPipeline$CompiledExecution.compileFilters(org/logstash/config/ir/CompiledPipeline.java:385)
	at org.logstash.config.ir.CompiledPipeline$CompiledExecution.<init>(org/logstash/config/ir/CompiledPipeline.java:363)
	at org.logstash.config.ir.CompiledPipeline$CompiledUnorderedExecution.<init>(org/logstash/config/ir/CompiledPipeline.java:322)
	at org.logstash.config.ir.CompiledPipeline.buildExecution(org/logstash/config/ir/CompiledPipeline.java:156)
	at org.logstash.execution.WorkerLoop.<init>(org/logstash/execution/WorkerLoop.java:67)
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(jdk/internal/reflect/NativeConstructorAccessorImpl.java:77)
	at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(jdk/internal/reflect/DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstanceWithCaller(java/lang/reflect/Constructor.java:499)
	at java.lang.reflect.Constructor.newInstance(java/lang/reflect/Constructor.java:480)
	at org.jruby.javasupport.JavaConstructor.newInstanceDirect(org/jruby/javasupport/JavaConstructor.java:253)
	at org.jruby.RubyClass.newInstance(org/jruby/RubyClass.java:939)
	at org.jruby.RubyClass$INVOKER$i$newInstance.call(org/jruby/RubyClass$INVOKER$i$newInstance.gen)
	at RUBY.init_worker_loop(/Users/mashhur/Dev/elastic/logstash/logstash-core/lib/logstash/java_pipeline.rb:569)
	at RUBY.start_workers(/Users/mashhur/Dev/elastic/logstash/logstash-core/lib/logstash/java_pipeline.rb:284)
	at org.jruby.RubyProc.call(org/jruby/RubyProc.java:318)
	at java.lang.Thread.run(java/lang/Thread.java:833)

When running with jruby -rbundler/setup -S rspec -fd spec/filters/kv_spec.rb

78) LogStash::Filters::KV test default_keys "hello=world foo=bar baz=fizz doublequoted=\"hello wo..." processes events as specified
      Failure/Error: Unable to find com.google.googlejavaformat.java.JavaInput.buildToks(com/google/googlejavaformat/java/JavaInput.java to read failed line
      
      Java::JavaLang::IllegalAccessError:
        class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x5400db7e) cannot access class com.sun.tools.javac.parser.Tokens$TokenKind (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module @0x5400db7e
      # com.google.googlejavaformat.java.JavaInput.buildToks(com/google/googlejavaformat/java/JavaInput.java:349)
      # com.google.googlejavaformat.java.JavaInput.buildToks(com/google/googlejavaformat/java/JavaInput.java:334)
      # com.google.googlejavaformat.java.JavaInput.<init>(com/google/googlejavaformat/java/JavaInput.java:276)
      # com.google.googlejavaformat.java.Formatter.getFormatReplacements(com/google/googlejavaformat/java/Formatter.java:280)
      # com.google.googlejavaformat.java.Formatter.formatSource(com/google/googlejavaformat/java/Formatter.java:267)
      # com.google.googlejavaformat.java.Formatter.formatSource(com/google/googlejavaformat/java/Formatter.java:233)
      # org.logstash.config.ir.compiler.ComputeStepSyntaxElement.generateCode(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:174)
      # org.logstash.config.ir.compiler.ComputeStepSyntaxElement.<init>(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:118)
      # org.logstash.config.ir.compiler.ComputeStepSyntaxElement.create(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:89)
      # org.logstash.config.ir.compiler.DatasetCompiler.prepare(org/logstash/config/ir/compiler/DatasetCompiler.java:321)
      # org.logstash.config.ir.compiler.DatasetCompiler.filterDataset(org/logstash/config/ir/compiler/DatasetCompiler.java:133)
      # org.logstash.config.ir.CompiledPipeline$CompiledExecution.filterDataset(org/logstash/config/ir/CompiledPipeline.java:417)
      # org.logstash.config.ir.CompiledPipeline$CompiledExecution.lambda$compileDependencies$6(org/logstash/config/ir/CompiledPipeline.java:523)
      # java.util.stream.ReferencePipeline$3$1.accept(java/util/stream/ReferencePipeline.java:197)
      # java.util.stream.ReferencePipeline$2$1.accept(java/util/stream/ReferencePipeline.java:179)
      # java.util.stream.ReferencePipeline$3$1.accept(java/util/stream/ReferencePipeline.java:197)
      # java.util.Iterator.forEachRemaining(java/util/Iterator.java:133)
      # java.util.Spliterators$IteratorSpliterator.forEachRemaining(java/util/Spliterators.java:1845)
      # java.util.stream.AbstractPipeline.copyInto(java/util/stream/AbstractPipeline.java:509)
      # java.util.stream.AbstractPipeline.wrapAndCopyInto(java/util/stream/AbstractPipeline.java:499)
      # java.util.stream.ReduceOps$ReduceOp.evaluateSequential(java/util/stream/ReduceOps.java:921)
      # java.util.stream.AbstractPipeline.evaluate(java/util/stream/AbstractPipeline.java:234)
      # java.util.stream.ReferencePipeline.collect(java/util/stream/ReferencePipeline.java:682)
      # org.logstash.config.ir.CompiledPipeline$CompiledExecution.compileDependencies(org/logstash/config/ir/CompiledPipeline.java:546)
      # org.logstash.config.ir.CompiledPipeline$CompiledExecution.flatten(org/logstash/config/ir/CompiledPipeline.java:500)
      # org.logstash.config.ir.CompiledPipeline$CompiledExecution.compileFilters(org/logstash/config/ir/CompiledPipeline.java:385)
      # org.logstash.config.ir.CompiledPipeline$CompiledExecution.<init>(org/logstash/config/ir/CompiledPipeline.java:363)
      # org.logstash.config.ir.CompiledPipeline$CompiledUnorderedExecution.<init>(org/logstash/config/ir/CompiledPipeline.java:322)
      # org.logstash.config.ir.CompiledPipeline.buildExecution(org/logstash/config/ir/CompiledPipeline.java:156)
      # org.logstash.execution.WorkerLoop.<init>(org/logstash/execution/WorkerLoop.java:67)
      # jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      # jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(jdk/internal/reflect/NativeConstructorAccessorImpl.java:77)
      # jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(jdk/internal/reflect/DelegatingConstructorAccessorImpl.java:45)
      # java.lang.reflect.Constructor.newInstanceWithCaller(java/lang/reflect/Constructor.java:499)
      # java.lang.reflect.Constructor.newInstance(java/lang/reflect/Constructor.java:480)
      # RUBY.init_worker_loop(/Users/mashhur/Dev/elastic/logstash/logstash-core/lib/logstash/java_pipeline.rb:569)
      # RUBY.start_workers(/Users/mashhur/Dev/elastic/logstash/logstash-core/lib/logstash/java_pipeline.rb:284)
      # java.lang.Thread.run(java/lang/Thread.java:833)
@andsel
Copy link
Contributor

andsel commented Jul 5, 2022

Is this issue closed by elastic/logstash#13825 ?

@mashhurs
Copy link
Contributor Author

This issue was resolved by elastic/logstash#13825

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants