See attached log for a ConcurrentModificationException occuring, since org.hibernate.osgi.OsgiClassLoader makes non-thread-safe access to field "classLoaders".
The same applies for field "bundles" from my point of view.
Note: with a LinkedHashSet is in use, that retains insertion-order.
Fixed version should also retain insertion-order and be thread-safe.
There is no simple Concurrent*Set that fulfills this, so a blocking, easy solution is making the Set synchronized and synchronizing on it when iterating.
Note 2: I recommend to make fields "classCache" and "resourceCache" ConcurrentMaps and then also flag the ClassLoader as parallel-capable via call to java.lang.ClassLoader#registerAsParallelCapable