JoegenUSTC opened a new issue, #11726:
URL: https://github.com/apache/gravitino/issues/11726
### What would you like to be improved?
## Background
PR #11707 fixed an intermittent `NoClassDefFoundError` caused by
`HiveCatalogCapability.caseSensitiveOnName()` being called outside the
`IsolatedClassLoader.withClassLoader()` boundary. The fix worked around the
issue by removing the compiler-generated synthetic `$1` class.
However, as noted in the PR review, this is a workaround rather than a root
fix.
## Root Cause
`CatalogWrapper.capabilities()` returns a `Capability` object loaded by the
catalog's isolated classloader. This object is then used **outside** the
`withClassLoader()` boundary (e.g., in `SchemaNormalizeDispatcher`). Any
`Capability` method implementation that references plugin-jar classes will
trigger a classloader mismatch, causing the JVM to permanently cache a
`NoClassDefFoundError` for the process lifetime.
## Scope of Impact
Any catalog that implements `Capability` methods referencing classes from the
plugin jar (e.g., using `switch-on-enum`, or calling plugin-internal types)
is potentially affected. This is not limited to the Hive catalog.
## Expected Fix
All calls to `Capability` methods should be made within the correct
classloader
context, either by:
1. Wrapping `capabilities()` call sites with `withClassLoader()`, or
2. Ensuring `CatalogWrapper` proxies `Capability` method calls through the
isolated classloader automatically.
## References
- PR: #11707
- Related: `CatalogWrapper.capabilities()`, `SchemaNormalizeDispatcher`,
`IsolatedClassLoader.withClassLoader()`
### How should we improve?
_No response_
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]