[hibernate-dev] ORM5 : Reusing the Configuration instance
Sanne Grinovero
sanne at hibernate.org
Sun Mar 15 19:36:00 EDT 2015
Hi all,
I'm trying to get an experimental branch of Hibernate Search to work
with the latest snapshot of Hibernate ORM 5.
After a bit of refactoring of our integration SPIs I thought it was
ready for some testing, but came to some surprising errors from the
ServiceLoader not finding the implementations from Hibernate Search -
although it would find the service definition of it.
After a bit more investigating, it turns out that the Integrator works
fine for each first test of our testsuite; it turns out that the
ClassLoaderService is referenced by the Configuration instance, and
this specific service nulls out all references to classloaders on
shutdown of the SessionFactory (which happens at the end of each of
our tests).
When the second test runs, it's reusing the same instance of ORM's
Configuration and so the ClassLoaderService gets reused and not
properly re-initialized, so it's not able to load any class.
So I'm wondering now if we should stop re-using the Configuration
instance in Search across tests, or if the ClassLoaderService in ORM
should be re-initialized on restart?
(this re-using business is mostly a convenience for how the Search
testsuite works but not strictly necessary)
If we should stop reusing the Configuration instances, then I'd like
to add a validation in ORM as the errormessage thrown from the
java.util.ServiceConfigurationError is confusing.
Thanks,
Sanne
More information about the hibernate-dev
mailing list