Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Duplicate
-
1.11.4
-
None
-
None
-
windows, java 11
Description
Using java 11 (openjdk 11 + 28) run-nifi.bat fails with the following message:
C:\Programs\nifi-1.11.4\bin>run-nifi.bat Exception in thread "main" java.lang.StringIndexOutOfBoundsException: nd -1, length 2 at java.base/java.lang.String.checkBoundsBeginEnd(String.java at java.base/java.lang.String.substring(String.java:1874) at org.apache.nifi.bootstrap.RunNiFi.start(RunNiFi.java:1040) at org.apache.nifi.bootstrap.RunNiFi.main(RunNiFi.java:240)
I believe the issue is caused as follows: nifi bootstrap tries to identify the major java version using a substring statement:
if (Integer.parseInt(runtimeJavaVersion.substring(0, runtimeJavaVersion.indexOf('.'))) >= 11) ...
However the version reported by openjdk 11+28 is “11”, this string doesn’t contain a period. Causing the failure. Using openjdk 11.0.2 resolves the issue.
Nifi bootstrap log:
With openjdk 11 +28
2020-08-11 11:47:06,846 DEBUG [main] o.a.n.b.NotificationServiceManager Found 0 service elements 2020-08-11 11:47:06,846 INFO [main] o.a.n.b.NotificationServiceManager Successfully loaded the following 0 services: [] 2020-08-11 11:47:06,846 INFO [main] org.apache.nifi.bootstrap.RunNiFi Registered no Notification Services for Notification Type NIFI_STARTED 2020-08-11 11:47:06,846 INFO [main] org.apache.nifi.bootstrap.RunNiFi Registered no Notification Services for Notification Type NIFI_STOPPED 2020-08-11 11:47:06,846 INFO [main] org.apache.nifi.bootstrap.RunNiFi Registered no Notification Services for Notification Type NIFI_DIED 2020-08-11 11:47:06,862 INFO [main] org.apache.nifi.bootstrap.RunNiFi Runtime Java version: 11
With openjdk 11.0.2
2020-08-11 12:09:20,942 DEBUG [main] o.a.n.b.NotificationServiceManager Found 0 service elements 2020-08-11 12:09:20,959 INFO [main] o.a.n.b.NotificationServiceManager Successfully loaded the following 0 services: [] 2020-08-11 12:09:20,959 INFO [main] org.apache.nifi.bootstrap.RunNiFi Registered no Notification Services for Notification Type NIFI_STARTED 2020-08-11 12:09:20,959 INFO [main] org.apache.nifi.bootstrap.RunNiFi Registered no Notification Services for Notification Type NIFI_STOPPED 2020-08-11 12:09:20,959 INFO [main] org.apache.nifi.bootstrap.RunNiFi Registered no Notification Services for Notification Type NIFI_DIED 2020-08-11 12:09:20,962 DEBUG [main] org.apache.nifi.bootstrap.Command Status File: C:\Programs\NIFI-1~1.4\bin\..\run\nifi.status 2020-08-11 12:09:20,963 DEBUG [main] org.apache.nifi.bootstrap.Command No status file to load properties from 2020-08-11 12:09:20,964 DEBUG [main] org.apache.nifi.bootstrap.Command No Port found in status file 2020-08-11 12:09:20,965 DEBUG [main] org.apache.nifi.bootstrap.Command Status File: C:\Programs\NIFI-1~1.4\bin\..\run\nifi.lock 2020-08-11 12:09:20,969 INFO [main] org.apache.nifi.bootstrap.RunNiFi Runtime Java version: 11.0.2 2020-08-11 12:09:20,983 INFO [main] org.apache.nifi.bootstrap.Command Starting Apache NiFi...
Attachments
Issue Links
- duplicates
-
NIFI-7687 NiFi fails to start when running on first release of JDK major version
- Resolved