Created 12-12-2024 09:57 PM
Hello,
Recently I setup NiFi 2.0.
Everytime I start NiFi, I get below warning messages in /var/log/messages.
Dec 13 12:07:58 myserver nifi.sh[208489]: WARNING: A restricted method in java.lang.foreign.Linker has been called
Dec 13 12:07:58 myserver nifi.sh[208489]: WARNING: java.lang.foreign.Linker::downcallHandle has been called by org.apache.lucene.store.PosixNativeAccess in an unnamed module
Dec 13 12:07:58 myserver nifi.sh[208489]: WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
Dec 13 12:07:58 myserver nifi.sh[208489]: WARNING: Restricted methods will be blocked in a future release unless native access is enabled
Is there any way to supress these messages?
Here are product versions.
Red Hat Enterprise Linux 8.8
NiFi 2.0.0
Java OpenJDK 23.0.1.0.11
Regards,
Created 12-17-2024 07:48 AM
@tono425
The error messages you are encountering in NiFi are related to Java's native method access restrictions introduced in newer Java versions (likely Java 17 or higher). These warnings indicate that NiFi (or a dependency like Apache Lucene) is calling restricted native methods that require explicit permission to access low-level operating system functions.
The warning mentions java.lang.foreign.Linker::downcallHandle, which is a native method used for low-level interactions with the operating system.
Here are the 3 options you should try to resolve the issue:
Edit the NiFi Java options in the bootstrap.conf file:
Created 12-13-2024 07:56 AM
@MattWho @steven-matison Hi! Do you have some insights here? Thanks!
Regards,
Diana Torres,Created 12-13-2024 08:48 AM
@tono425
Apache NiFi 2.0.0 has only been tested and verified against Java 21. I suggest switching to latest Java 21 JDK update and seeing if same messages persist in your Linux /var/log/messages log.
NiFi 2.0.0 System requirements
Please help our community thrive. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.
Thank you,
Matt
Created 12-15-2024 06:15 PM
@MattWho
Thank you for your advice.
I installed Java 21 (21.0.5) but similar warnings still persist.
Dec 16 11:09:10 myserver nifi.sh[253936]: WARNING: A restricted method in java.lang.foreign.Linker has been called
Dec 16 11:09:10 myserver nifi.sh[253936]: WARNING: java.lang.foreign.Linker::downcallHandle has been called by the unnamed module
Dec 16 11:09:10 myserver nifi.sh[253936]: WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for this module
Thank you,
Created 12-16-2024 05:08 AM
@tono425
It is just a WARNING that can safely be ignored.
I found some threads on this here:
https://bugs.openjdk.org/browse/JDK-8310626
https://apachenifi.slack.com/archives/C0L9VCD47/p1730736181056549?thread_ts=1730294478.475309&cid=C0...
https://www.reddit.com/r/java/comments/17cjajl/why_introduce_a_mandatory_enablenativeaccess/
I suppose you could try adding a new java.arg.<some string/num> to the NiFi bootstrap.conf to "--enable-native-access=ALL-UNNAMED" to see if that stops these Warnings on NiFi startup.
Please help our community thrive. If you found any of the suggestions/solutions provided helped you with solving your issue or answering your question, please take a moment to login and click "Accept as Solution" on one or more of them that helped.
Thank you,
Matt
Created 12-17-2024 07:48 AM
@tono425
The error messages you are encountering in NiFi are related to Java's native method access restrictions introduced in newer Java versions (likely Java 17 or higher). These warnings indicate that NiFi (or a dependency like Apache Lucene) is calling restricted native methods that require explicit permission to access low-level operating system functions.
The warning mentions java.lang.foreign.Linker::downcallHandle, which is a native method used for low-level interactions with the operating system.
Here are the 3 options you should try to resolve the issue:
Edit the NiFi Java options in the bootstrap.conf file:
Created 12-17-2024 04:48 PM
@Shelton
Thank you for your advice.
As I use the latest version of NiFi and it requires Java 21, I added the following line in bootstrap.conf and confirmed the warning messages disappeared.
java.arg.EnableNativeAccess=--enable-native-access=ALL-UNNAMED
I appreciate your help.
Thank you,