JoegenUSTC opened a new pull request, #11705:
URL: https://github.com/apache/gravitino/pull/11705

   ### What changes were proposed in this pull request?
   
   Add `org.apache.gravitino.hive.` as a recognized catalog class prefix in
   `IsolatedClassLoader.isCatalogClass()`, and add unit tests to cover the
   classification of all hive-related packages.
   
   ### Why are the changes needed?
   
   Fix: #11704
   
   PR #9460 refactored the Hive catalog and moved classes such as
   `HiveExceptionConverter` from `org.apache.gravitino.catalog.hive.*` to
   `org.apache.gravitino.hive.*`. However, `isCatalogClass()` was not updated,
   so classes under `org.apache.gravitino.hive.*` are incorrectly treated as
   shared classes and delegated to the server classloader.
   
   In certain classloader initialization timing windows, the server classloader
   becomes the defining classloader for `HiveExceptionConverter`. Its
   compiler-generated synthetic class `$1` (produced by `switch`-on-enum) is
   then requested from the server classloader, which cannot find it in the 
server
   classpath. **The JVM permanently caches this load failure for the process
   lifetime**, causing all subsequent calls to throw `NoClassDefFoundError` 
until
   the process is restarted.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. This is an internal classloader fix with no API or behavior change.
   
   ### How was this patch tested?
   
   Added `TestIsolatedClassLoader` with four test methods covering:
   - `org.apache.gravitino.hive.*` classes are recognized as catalog classes
   - `org.apache.gravitino.catalog.hive.*` classes continue to be recognized
   - Other catalog packages (`lakehouse`, `jdbc`, `kafka`, etc.) are unaffected
   - Server-side shared classes are correctly excluded


-- 
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]

Reply via email to