- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Getting java warning after staring NiFi
- Labels:
-
Apache NiFi
Created 12-12-2024 09:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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:
Option 1: Add the Java Option to Enable Native Access
- Update the NiFi startup configuration to allow unrestricted native access for unnamed modules.
Edit the NiFi Java options in the bootstrap.conf file:
Option 2: Use a Lower Java Version (if possible)
- If NiFi was previously running fine with an earlier Java version (e.g., Java 8 or 11), you can revert to it until you're ready to address the native access changes:
- Update the JAVA_HOME path in NiFi's bootstrap.conf to point to the older Java version.
Option 3: Verify Dependencies
- Check if you are using the latest versions of NiFi and Apache Lucene:
- Some of these warnings may be addressed in recent releases of NiFi or its libraries.
- Consider upgrading NiFi to the latest stable version to ensure compatibility with newer Java versions.
Happy hadooping
Created 12-13-2024 07:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@MattWho @steven-matison Hi! Do you have some insights here? Thanks!
Regards,
Diana Torres,Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community:
Created 12-13-2024 08:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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:
Option 1: Add the Java Option to Enable Native Access
- Update the NiFi startup configuration to allow unrestricted native access for unnamed modules.
Edit the NiFi Java options in the bootstrap.conf file:
Option 2: Use a Lower Java Version (if possible)
- If NiFi was previously running fine with an earlier Java version (e.g., Java 8 or 11), you can revert to it until you're ready to address the native access changes:
- Update the JAVA_HOME path in NiFi's bootstrap.conf to point to the older Java version.
Option 3: Verify Dependencies
- Check if you are using the latest versions of NiFi and Apache Lucene:
- Some of these warnings may be addressed in recent releases of NiFi or its libraries.
- Consider upgrading NiFi to the latest stable version to ensure compatibility with newer Java versions.
Happy hadooping
Created 12-17-2024 04:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@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,
