# Illegal reflective access errors

**URL:** <https://discuss.elastic.co/t/illegal-reflective-access-errors/323020>\
**Category:** Logstash\
**Created:** [January 12, 2023, 11:40am UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020 "2023-01-12T11:40:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![djrshn2346](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djrshn2346/32/108594_2.png) [@djrshn2346](https://discuss.elastic.co/u/djrshn2346)\
**Post date:** [January 12, 2023, 11:40am UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020/1 "2023-01-12T11:40:41Z")

</div>

Getting Illegal reflective access errors along with these warnings:

```auto

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.ext.openssl.SecurityHelper (file:/{...}/jruby{...}jopenssl.jar) to field java.security.MessageDigest.provider
WARNING: Please consider reporting this to the maintainers of org.jruby.ext.openssl.SecurityHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

```

Tried these solutions but none of them are working:

> <https://stackoverflow.com/questions/70427604/groovy-warning-an-illegal-reflective-access-operation-has-occurred-under-ubuntu>

> <https://github.com/jruby/jruby/issues/6049>
>
> \### Environment
> \- jruby 9.2.9.0 (2.5.7) 2019-10-30 458ad3e OpenJDK 64-Bit Serve…r VM 13.0.2+8 on 13.0.2+8 +jit \[darwin-x86\_64\]
> \- openjdk version "13.0.2" 2020-01-14 \[AdoptOpenJDK (build 13.0.2+8)\]
> \- macOS Mojave 10.14.6
> 
> \#### Notes
> \- Installed adoptopenjdk using \[homebrew-cask formula\](https://github.com/Homebrew/homebrew-cask/blob/959836865f73a4a8e21e6aaee1ffb4db5f27c19f/Casks/adoptopenjdk.rb)
> \- Installed jruby using \[ruby-build formula\](https://github.com/rbenv/ruby-build/blob/73b926b77cd971946dfe966cfb2c954e1d24a12e/share/ruby-build/jruby-9.2.9.0)
> 
> \### Observed behavior
> 
> \`\`\`
> $ jruby -e 'puts "hi"'
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by com.headius.backport9.modules.Modules to method sun.nio.ch.NativeThread.signal(long)
> WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
> WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
> WARNING: All illegal access operations will be denied in a future release
> hi
> \`\`\`
> 
> \### Expected behavior
> 
> No warnings.
> 
> \### Investigation/Similar Issues
> 
> \- headius/backport9#2
> - Tried the suggested \`--add-opens\` flags, no change
> 
> \- #5864
> - Running newer jruby build, still seeing same warnings

> <https://github.com/elastic/logstash/issues/10496>
>
> When running Logstash \`6.7.0\` Build Candidate with OpenJDK Java 11, warnings abo…ut \`IllegalReflectiveAccess\` are displayed:
> 
> \`\`\`
> WARNING: An illegal reflective access operation has occurred
> WARNING: Illegal reflective access by org.jruby.util.SecurityHelper (file:/Users/robbavey/test/6.7.0bc3/logstash-6.7.0/logstash-core/lib/jars/jruby-complete-9.2.6.0.jar) to field java.lang.reflect.Field.modifiers
> WARNING: Please consider reporting this to the maintainers of org.jruby.util.SecurityHelper
> WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
> WARNING: All illegal access operations will be denied in a future release\`\`\`
> \`\`\`
> This appears to be related to a \[known issue\](https://github.com/jruby/jruby/issues/4834) in JRuby. 
> 
> \[This comment\](https://github.com/jruby/jruby/issues/4834#issuecomment-382917227) describes a mitigation to avoid the warnings. Adding the following to \`jvm.options\` (caveat: only tested with a very simple pipeline) will allow Logstash to start without warning in Java 11, but prevents Logstash from starting up on Java 8:
> 
> \`\`\`
> \--add-opens=java.base/java.lang=ALL-UNNAMED 
> \--add-opens=java.base/java.security=ALL-UNNAMED 
> \--add-opens=java.base/java.util=ALL-UNNAMED 
> \--add-opens=java.base/java.security.cert=ALL-UNNAMED 
> \--add-opens=java.base/java.util.zip=ALL-UNNAMED 
> \--add-opens=java.base/java.lang.reflect=ALL-UNNAMED 
> \--add-opens=java.base/java.util.regex=ALL-UNNAMED 
> \--add-opens=java.base/java.net=ALL-UNNAMED 
> \--add-opens=java.base/java.io=ALL-UNNAMED 
> \--add-opens=java.base/java.lang=ALL-UNNAMED
> \--add-opens=java.base/javax.crypto=ALL-UNNAMED
> \--add-opens=java.management/sun.management=ALL-UNNAMED
> \`\`\`

> <https://github.com/elastic/logstash/pull/11152>
>
> Add info for Java 11 \`illegal reflective access\` errors. 
> 
> Fixes #10498 
> Rela…ted: #10496

> **[Troubleshooting Logstash | Logstash Reference \[8.6\] | Elastic](https://www.elastic.co/guide/en/logstash/current/ts-logstash.html)**

Can anyone help here?

Thanks in advance.

---

<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:** [January 12, 2023, 6:23pm UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020/2 "2023-01-12T18:23:20Z")

</div>

When you start logstash you should get a "Starting Logstash" message that reports the logstash and jruby version. What does it show?

---

<div class="post-metadata">

**Author:** ![djrshn2346](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djrshn2346/32/108594_2.png) [@djrshn2346](https://discuss.elastic.co/u/djrshn2346)\
**Post date:** [January 13, 2023, 5:22am UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020/3 "2023-01-13T05:22:05Z")

</div>

JRUBY\_VERSION="9.3.8.0"  
LOGSTASH="8.4.3"

---

<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:** [January 13, 2023, 6:45pm UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020/4 "2023-01-13T18:45:21Z")

</div>

See [here](https://www.elastic.co/guide/en/logstash/current/ts-logstash.html#ts-illegal-reflective-error). Some of the underlying access errors in SecurityHelper were fixed in JRuby 9.3, but apparently not all.

---

<div class="post-metadata">

**Author:** ![djrshn2346](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djrshn2346/32/108594_2.png) [@djrshn2346](https://discuss.elastic.co/u/djrshn2346)\
**Post date:** [January 16, 2023, 5:01am UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020/5 "2023-01-16T05:01:52Z")

</div>

Yes, i have tried these but still not working. It is also pasted in my question.

---

<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:** [January 16, 2023, 5:30pm UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020/6 "2023-01-16T17:30:25Z")

</div>

OK, so as the message says, report it to the maintainers of org.jruby.ext.openssl.SecurityHelper. They are the folks who can fix it.

---

<div class="post-metadata">

**Author:** ![djrshn2346](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/djrshn2346/32/108594_2.png) [@djrshn2346](https://discuss.elastic.co/u/djrshn2346)\
**Post date:** [January 23, 2023, 9:58am UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020/7 "2023-01-23T09:58:24Z")

</div>

Hi @Badger ,  
Can you help me how to report them?

---

<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:** [February 20, 2023, 9:59am UTC](https://discuss.elastic.co/t/illegal-reflective-access-errors/323020/8 "2023-02-20T09:59:01Z")

</div>

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