# Error starting Logstash pipeline after upgrading to Java 17

**URL:** <https://discuss.elastic.co/t/error-starting-logstash-pipeline-after-upgrading-to-java-17/334346>\
**Category:** Logstash\
**Created:** [May 25, 2023, 2:56pm UTC](https://discuss.elastic.co/t/error-starting-logstash-pipeline-after-upgrading-to-java-17/334346 "2023-05-25T14:56:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikhil\_Khurana](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nikhil_khurana/32/119984_2.png) [@Nikhil\_Khurana](https://discuss.elastic.co/u/Nikhil_Khurana)\
**Post date:** [May 25, 2023, 2:56pm UTC](https://discuss.elastic.co/t/error-starting-logstash-pipeline-after-upgrading-to-java-17/334346/1 "2023-05-25T14:56:44Z")

</div>

I have bundled Logstash within my Java application and launch it using JRuby. It worked fine until upgrading to Java 17. After upgrading, the pipeline fails to start with following exception :

> | java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x7df34a68) 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 @0x7df34a68Thu 05 25 14:48:24:925 UTC 2023 | at com.google.googlejavaformat.java.JavaInput.buildToks(com/google/googlejavaformat/java/JavaInput.java:349) |
> | --- | --- |
> | Thu 05 25 14:48:24:925 UTC 2023 | at com.google.googlejavaformat.java.JavaInput.buildToks(com/google/googlejavaformat/java/JavaInput.java:334) |
> | Thu 05 25 14:48:24:925 UTC 2023 | at com.google.googlejavaformat.java.JavaInput.(com/google/googlejavaformat/java/JavaInput.java:276) |
> | Thu 05 25 14:48:24:925 UTC 2023 | at com.google.googlejavaformat.java.Formatter.getFormatReplacements(com/google/googlejavaformat/java/Formatter.java:260) |
> | Thu 05 25 14:48:24:925 UTC 2023 | at com.google.googlejavaformat.java.Formatter.formatSource(com/google/googlejavaformat/java/Formatter.java:247) |
> | Thu 05 25 14:48:24:925 UTC 2023 | at com.google.googlejavaformat.java.Formatter.formatSource(com/google/googlejavaformat/java/Formatter.java:213) |
> | Thu 05 25 14:48:24:925 UTC 2023 | at org.logstash.config.ir.compiler.ComputeStepSyntaxElement.generateCode(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:174) |
> | Thu 05 25 14:48:24:925 UTC 2023 | at org.logstash.config.ir.compiler.ComputeStepSyntaxElement.(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:118) |
> | Thu 05 25 14:48:24:925 UTC 2023 | at org.logstash.config.ir.compiler.ComputeStepSyntaxElement.create(org/logstash/config/ir/compiler/ComputeStepSyntaxElement.java:89) |

I added JVM options **--add-exports** in the jvm.options file within config based on the recommendation here : [[Java17] Add `--add-export` settings to restore JDK17 compatibility by robbavey · Pull Request #13825 · elastic/logstash · GitHub](https://github.com/elastic/logstash/pull/13825)

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/9/09a4d27ac74103cf2a2a245443e9dcd062f2c476.png)

Although the error is still not resolved. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 25, 2023, 4:19pm UTC](https://discuss.elastic.co/t/error-starting-logstash-pipeline-after-upgrading-to-java-17/334346/2 "2023-05-25T16:19:21Z")

</div>

[This](https://github.com/google/google-java-format/issues/787) issue has a larger set of add-exports/add-opens options that are used to fix this in a different app.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 22, 2023, 4:19pm UTC](https://discuss.elastic.co/t/error-starting-logstash-pipeline-after-upgrading-to-java-17/334346/3 "2023-06-22T16:19:33Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
