The org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl stores the thread context classloader during the startup. Since this ClassLoader is only available during the bootstrap, all further call to it will cause a warning in the logs, having the following stack:
This is done by the following piece of code in the class constructor (line 83):
Actually, this has no functional impact since the needed classes will always be found in the provided ClassLoader which is given by the EntityManagerFactoryBuilderImpl (line 360) because it's the PersistenceUnit's one and will always be available.
However, the adding of the TCCL should be configurable by a property and/or be platform-configured by default (for Glassfish, SunOneJtaPlatform).
I attached a patch as proposal for a fix, which adds the property hibernate.classloader.tccl_lookup which can handle the values never,before,after, although I'm not sure it is relevant to handle the before and after behaviours... But I think it's interesting to have them since the thread context ClassLoader could change during the runtime.
Any feedback would be appreciated.
Thanks in advance.
PS. This issue replaces HHH-11243 Closed