Description
Describe the Issue
When I call java.time.chrono.Chronology.getAvailableChronologies(), for example like this:
`
import java.time.chrono.Chronology;
public class App {
public static void main(String[] args) throws IOException {
for(Chronology chronology : Chronology.getAvailableChronologies()) {
System.out.println(chronology.getId() + " - " + chronology.getClass().getName());
}
}
}
`
it results in a NullPointerException.
Using the latest version of GraalVM can resolve many issues.
- I tried with the latest version of GraalVM.
GraalVM Version
java version "25" 2025-09-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 25-dev+25.1 (build 25+25-LTS-jvmci-b01)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 25-dev+25.1 (build 25+25-LTS-jvmci-b01, mixed mode, sharing)
Operating System and Version
OSX 15.4.1 (24E263)
Troubleshooting Confirmation
- I tried the suggestions in the troubleshooting guide.
Run Command
it's maven setup:
Expected Behavior
no NPE exception
Actual Behavior
java.lang.NullPointerException
Steps to Reproduce
- mvn clean package -Pwasm
- run http-server at web folder
- open broswer localhost:8080
- check console
Additional Context
Maybe it's somehow connected with ServiceLoader:
static Set getAvailableChronologies() {
initCache(); // force initialization
HashSet chronos = new HashSet<>(CHRONOS_BY_ID.values());
/// Add in Chronologies from the ServiceLoader configuration
ServiceLoader<Chronology> loader = ServiceLoader.load(Chronology.class);
for (Chronology chrono : loader) {
chronos.add(chrono);
}
return chronos;
}
but it's part of java
Run-Time Log Output and Error Messages
app.js:266 Exception in thread "main" java.lang.ExceptionInInitializerError
app.js:266 at genBacktrace (http://127.0.0.1:8080/app.js:1229:12)
app.js:266 at genBacktrace (http://127.0.0.1:8080/app.js:1299:32)
app.js:266 at _ClassInitializationInfo_doInitialize___ClassInitializationInfo_Class_V (wasm://wasm/02706d1a:wasm-function[918]:0x15c5f6)
app.js:266 at ClassInitializationInfo_slowPath___ClassInitializationInfo_Class_V (wasm://wasm/02706d1a:wasm-function[1329]:0x16da12)
app.js:266 at AbstractChronology_initCache___Z (wasm://wasm/02706d1a:wasm-function[9422]:0x2cdf23)
app.js:266 at AbstractChronology_getAvailableChronologies___Set (wasm://wasm/02706d1a:wasm-function[9430]:0x2ce667)
app.js:266 at App_main$Ljava_lang_String__V (wasm://wasm/02706d1a:wasm-function[9475]:0x2d0991)
app.js:266 at WebImageJavaMainSupport_doRun$Ljava_lang_String__WebImageJavaMainSupport$Runner_I (wasm://wasm/02706d1a:wasm-function[586]:0x14b8da)
app.js:266 at WebImageWasmGCJavaMainSupport_run$Ljava_lang_String__I (wasm://wasm/02706d1a:wasm-function[1132]:0x16677f)
app.js:266 Caused by: java.lang.NullPointerException
app.js:266 at genBacktrace (http://127.0.0.1:8080/app.js:1229:12)
app.js:266 at genBacktrace (http://127.0.0.1:8080/app.js:1299:32)
app.js:266 at _ImplicitExceptions_throwNewNullPointerException___V (wasm://wasm/02706d1a:wasm-function[1309]:0x16cab2)
app.js:266 at _PathService$1_apply___Object_Z (wasm://wasm/02706d1a:wasm-function[8872]:0x2a47cc)
app.js:266 at _Iterators$5_computeNext___Object (wasm://wasm/02706d1a:wasm-function[7524]:0x259ddd)
app.js:266 at func.bridge._AbstractIterator.computeNext___Object (wasm://wasm/02706d1a:wasm-function[3190]:0x183321)
app.js:266 at _AbstractIterator_hasNext___Z (wasm://wasm/02706d1a:wasm-function[7526]:0x259f30)
app.js:266 at func.bridge._Iterator.hasNext___Z (wasm://wasm/02706d1a:wasm-function[3686]:0x185527)
app.js:266 at _Joiner_appendTo___Appendable_Iterator_Appendable (wasm://wasm/02706d1a:wasm-function[4023]:0x1939b8)