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:
{noformat} Warning: ASURLClassLoader EarClassLoader : doneCalled = true doneSnapshot = ASURLClassLoader.done() called ON EarClassLoader : urlSet = [URLEntry : <entries>] doneCalled = false Parent -> org.glassfish.internal.api.DelegatingClassLoader@7a442fc6 AT Fri Nov 11 20:10:22 CET 2016 BY :[java.lang.Thread.getStackTrace(Thread.java:1556), com.sun.enterprise.loader.ASURLClassLoader.done(ASURLClassLoader.java:216), com.sun.enterprise.loader.ASURLClassLoader.preDestroy(ASURLClassLoader.java:184), org.glassfish.javaee.full.deployment.EarClassLoader.preDestroy(EarClassLoader.java:100), org.glassfish.deployment.common.DeploymentContextImpl.getClassLoader(DeploymentContextImpl.java:266), org.glassfish.deployment.common.DeploymentContextImpl.getClassLoader(DeploymentContextImpl.java:216), com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:485), com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219), org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491), com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:539), com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:535), java.security.AccessController.doPrivileged(Native Method), javax.security.auth.Subject.doAs(Subject.java:360), com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:534), com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:565), com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:557), java.security.AccessController.doPrivileged(Native Method), javax.security.auth.Subject.doAs(Subject.java:360), com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:556), com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1464), com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:109), com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1846), com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1722), com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534), com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224), org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189), com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459), com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167), org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:201), org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:175), org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235), org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119), org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284), org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201), org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133), org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112), org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77), org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:561), org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112), org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117), org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56), org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137), org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565), org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545), java.lang.Thread.run(Thread.java:745)] Parent -> org.glassfish.internal.api.DelegatingClassLoader@7a442fc6 was requested to find class ch.astorm.entities after done was invoked from the following stack trace java.lang.Throwable at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:825) at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:742) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:209) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:226) ... {noformat}
This is done by the following piece of code in the class constructor (line 83):
{code:java} // then the TCCL, if one... final ClassLoader tccl = locateTCCL(); if ( tccl != null ) { orderedClassLoaderSet.add( tccl ); } {code}
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 |
|