CDV ❯ Cannot create multiple session factories (with terracotta 2nd level caches) in the same app classloader using standalone product
-
Bug
-
Status: Closed
-
1 Critical
-
Resolution: Fixed
-
-
-
kkannaiy
-
Reporter: teck
-
July 27, 2009
-
0
-
Watchers: 0
-
February 12, 2013
-
July 31, 2009
Attachments
Description
My guess is that is far more the exception than the rule to create more than one session factory in application, but this currently doesn’t work with standalone H2LC. You’ll get a loader constraint violation (like the one attached). The problem is easy to recreate, just create more than one hibernate session factory (in the same application. in the same VM) and use TC caching in both.
This problem has many things underlying it. It happens because we are currently bootstrapping each clustered cache instances in their own classloader. Our bootstrap loader however shares types with the app classloader (specifically for those types that are normally in the boot jar). Since the type closure of our boot is wildly out of wack, you’ll get these types of errors.
It is possible we might be able to workaround the messy boot jar by only creating one common/static bootstrap loader although this really shouldn’t be required from a pure technical perspective. There might be other arguments for only creating one loader, but this should not be a driving factor (the boot jar should be cleaned up instead)
system test added to terracotta-hibernate-cache