[External] : ClassNotFoundException for Custom Scheduler Prototype v2
Mengyang Li
dreamlike.vertx at gmail.com
Thu Feb 26 02:49:11 UTC 2026
Hello everyone,
With “Custom Scheduler Prototype v2”, the JDK loads the class specified by
jdk.virtualThreadScheduler.implClass via the internal AppClassLoader. This
works for typical apps, but fails for Spring Boot fat JARs where the
application class loader is often
org.springframework.boot.loader.launch.LaunchedClassLoader, resulting in:
``` text
Exception in thread "main" java.lang.reflect.InvocationTargetException
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at
org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:106)
at
org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:64)
at
org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:40)
Caused by: java.lang.Error: java.lang.ClassNotFoundException:
io.github.dreamlike.springvirtualthread.CustomerVirtualThreadScheduler
at
java.base/java.lang.VirtualThread.loadCustomScheduler(VirtualThread.java:1511)
at java.base/java.lang.VirtualThread.<clinit>(VirtualThread.java:84)
at
java.base/java.lang.ThreadBuilders.newVirtualThread(ThreadBuilders.java:403)
at
java.base/java.lang.ThreadBuilders.newVirtualThread(ThreadBuilders.java:412)
at java.base/java.lang.Thread.startVirtualThread(Thread.java:1631)
at
io.github.dreamlike.springvirtualthread.SpringVirtualThreadApplication.main(SpringVirtualThreadApplication.java:13)
at
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
... 4 more
Caused by: java.lang.ClassNotFoundException:
io.github.dreamlike.springvirtualthread.CustomerVirtualThreadScheduler
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:580)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:502)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:560)
at
java.base/java.lang.VirtualThread.loadCustomScheduler(VirtualThread.java:1500)
... 10 more
```
Would it be feasible to switch to an SPI (similar to JDBC) so custom
schedulers are pluggable under non-standard class loaders? Potentially the
same approach could apply to a pluggable Poller API.
Thanks for any guidance or discussion.
Best regards,
Mengyang Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20260226/95a4487d/attachment-0001.htm>
More information about the loom-dev
mailing list