You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "LuciferYang (via GitHub)" <gi...@apache.org> on 2026/09/10 17:16:19 UTC

[I] isClassLoadable answers false on threads without a context classloader [kyuubi]

LuciferYang opened a new issue, #7733:
URL: https://github.com/apache/kyuubi/issues/7733

   ### Describe the bug
   
   `ReflectUtils.isClassLoadable` defaults its loader to the thread context classloader:
   
   ```scala
   def isClassLoadable(
       className: String,
       cl: ClassLoader = Thread.currentThread().getContextClassLoader): Boolean = ...
   ```
   
   On a thread whose context classloader is null, `DynClasses.builder().loader(null)` resolves the name with `Class.forName(name, true, null)`, which delegates to the bootstrap loader. The bootstrap loader sees only JDK classes, so the probe answers `false` for every application class, including Kyuubi's own, even when that class is loadable through the loader that defined `ReflectUtils`.
   
   A thread can carry a null context classloader in embedded scenarios: a host that starts the JVM through the JNI invocation API without setting one, or a container framework that clears it. `Logging` and `JDBCMetadataStore` probe optional integrations through this helper, so on such a thread the SLF4J bridge or the MySQL driver would be reported as absent when it is present.
   
   Spark's own `Utils.classForName` / `getContextOrSparkClassLoader` guard against this by falling back to a real loader instead of trusting a null context loader.
   
   ### Affects Version(s)
   
   master (1.13.0-SNAPSHOT), and earlier releases carrying `kyuubi-util-scala`.
   
   ### Are you willing to submit PR?
   
   Yes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org