Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8340413

java.lang.BootstrapMethodError: java.lang.NullPointerException: Cannot invoke "java.lang.Module.isExported(String)" because "refModule" is null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 17
    • core-libs

      We have seen several instances of this exception during application startup. The first encountered was of the form:
      ```
      2024-01-14 12:08:05.800,"Caused by: java.lang.BootstrapMethodError: java.lang.NullPointerException: Cannot invoke ""java.lang.Module.isExported(String)"" because ""refModule"" is null"
      2024-01-14 12:08:05.800, at java.base/sun.util.cldr.CLDRLocaleProviderAdapter.<init>(CLDRLocaleProviderAdapter.java:85)
      ```
      Which has this code on that line:
      ```
      nbmi = AccessController.doPrivileged((PrivilegedExceptionAction<LocaleDataMetaInfo>) () -> {
      ```
      https://github.com/openjdk/jdk17u-dev/blob/master/src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java#L85

      Erroneously believing this to be a problem with CLDRLocaleProviderAdapter, we tried using the JRE provider with: `-Djava.locale.providers=JRE,CLDR` but this only changed which caller encounters the exception:

      ```
      2024-05-04 15:42:02.149: Caused by: java.lang.BootstrapMethodError: java.lang.NullPointerException: Cannot invoke "java.lang.Module.isExported(String)" because "refModule" is null
      2024-05-04 15:42:02.149: at sun.util.locale.provider.JRELocaleProviderAdapter.getTimeZoneNameProvider(JRELocaleProviderAdapter.java:301) ~[?:?]
      ```
      However, the code here is also trying to perform a privileged action:
      ```
      TimeZoneNameProvider provider = AccessController.doPrivileged(
      ```

      https://github.com/openjdk/jdk17u-dev/blob/master/src/java.base/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java#L301

      This happens rarely and always near application startup. We do not have a reproducer yet. It feels like an initialization race within the module system, but I'm no expert here.

            naoto Naoto Sato
            wkemper William Kemper
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: