hibernate-orm icon indicating copy to clipboard operation
hibernate-orm copied to clipboard

HHH-13046 AggregatedClassLoader in JCacheRegionFactory

Open milgner opened this issue 1 year ago • 1 comments

Fixes https://hibernate.atlassian.net/browse/HHH-13046 by querying the classloader from the ClassLoaderService.

There is one drawback here: in scenarios where services are actually stopped (OSGi?), the class loader instance will have leaked to the cache factory.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion. For more information on licensing, please check here.


milgner avatar Aug 02 '24 10:08 milgner

Thanks for your pull request!

This pull request appears to follow the contribution rules.

› This message was automatically generated.

As it turns out, my changes aren't enough to fix the issue. The test suite itself is running into ClassLoader-related issues, resulting in a defunct singleton and ultimately multiple cache managers. I already commented on the issue. I will try to find some time this weekend for further investigation and a different approach.

The problem being addressed is the fact that when the JSR/JCache cache manager doesn't have access to the same class loader as Hibernate, it can end up being unable to access a class when working with an Entity whose class wasn't loaded by the default application class loader.

milgner avatar Aug 30 '24 08:08 milgner

Gonna close it for now and re-open once I have a better solution.

milgner avatar Sep 02 '24 11:09 milgner