CDV ❯ Improve error message for missing classloader
Bug
Status:Closed
2 Major
Resolution:Duplicate
DSO:L1
interfaces
Reporter:wharley
March 09, 2009
0
Watchers:1
July 27, 2012
March 12, 2009
Description
Now that we’ve moved sessions to the forge, some applications and tests that used to work will fail somewhat mysteriously with an IllegalStateException, along the lines of the appended stack trace.
This exception happens because the container TIM (in the below case, tim-tomcat-6.0) was not included in the modules list. It would be nice to expand this error message a little bit, to suggest that the user may be missing a TIM. The message is generated in NamedLoaderAdapter, which is applied to java.lang.ClassLoader, so it needs to be phrased very generally, but still it is safe to assume that if a user hits this it is because of some missing integration code.
I would suggest “This classloader instance has not been registered. This may indicate that a required Terracotta Integration Module is missing from the Terracotta configuration. (loader class: org.apache.catalina.loader.WebappClassLoader)”
As an aside, the reason this specific exception happens is that in lieu of the container TIM, the WebappClassLoader gets an implementation of NamedClassLoader from our instrumentation of java.lang.ClassLoader. Thus, it’s still a NamedClassLoader as far as com.tcspring.ApplicationHelper is concerned, but it has not been registered. This makes me somewhat suspicious of TC core code (like the constructor of ApplicationHelper) that tries to check whether a ClassLoader is an instanceof NamedClassLoader - if TC is running at all, this will always be true, and if TC is not running, how would the check get executed?
The problem has existed all along but it is made more likely by sessions -> forge.
[WARNING] [cargo0] java.lang.IllegalStateException: Classloader name not set, instances defined from this loader not supported in Terracotta (loader: org.apache.catalina.loader.WebappClassLoader)
[WARNING] [cargo0] at java.lang.ClassLoader.__tc_getClassLoaderName(ClassLoader.java)
[WARNING] [cargo0] at com.tcspring.ApplicationHelper.getAppNameFrom(ApplicationHelper.java:49)
[WARNING] [cargo0] at com.tcspring.ApplicationHelper.(ApplicationHelper.java:42)
[WARNING] [cargo0] at com.tcspring.DistributableBeanFactoryMixin.(DistributableBeanFactoryMixin.java:64)
[WARNING] [cargo0] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[WARNING] [cargo0] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[WARNING] [cargo0] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[WARNING] [cargo0] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[WARNING] [cargo0] at com.tc.aspectwerkz.aspect.DefaultMixinFactory.mixinOf(DefaultMixinFactory.java:130)
[WARNING] [cargo0] at com.tc.aspectwerkz.aspect.management.Mixins.mixinOf(Mixins.java:142)
[WARNING] [cargo0] at com.tc.aspectwerkz.aspect.management.Mixins.mixinOf(Mixins.java:124)
[WARNING] [cargo0] at org.springframework.beans.factory.support.AbstractBeanFactory.(AbstractBeanFactory.java:147)
[WARNING] [cargo0] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.(AbstractAutowireCapableBeanFactory.java:144)
[WARNING] [cargo0] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.(AbstractAutowireCapableBeanFactory.java:155)
[WARNING] [cargo0] at org.springframework.beans.factory.support.DefaultListableBeanFactory.(DefaultListableBeanFactory.java:121)
[WARNING] [cargo0] at org.springframework.context.support.AbstractRefreshableApplicationContext.createBeanFactory(AbstractRefreshableApplicationContext.java:176)
[WARNING] [cargo0] at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:121)
[WARNING] [cargo0] at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
[WARNING] [cargo0] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
[WARNING] [cargo0] at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
[WARNING] [cargo0] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
[WARNING] [cargo0] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
[WARNING] [cargo0] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
[WARNING] [cargo0] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
[WARNING] [cargo0] at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
[WARNING] [cargo0] at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
[WARNING] [cargo0] at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
[WARNING] [cargo0] at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
[WARNING] [cargo0] at org.apache.catalina.core.StandardService.start(StandardService.java:516)
[WARNING] [cargo0] at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
[WARNING] [cargo0] at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
[WARNING] [cargo0] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[WARNING] [cargo0] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[WARNING] [cargo0] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[WARNING] [cargo0] at java.lang.reflect.Method.invoke(Method.java:597)
[WARNING] [cargo0] at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
[WARNING] [cargo0] at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Comments
Tim Eck2009-03-09
The message could allude to a missing TIM for sure. Of course this isn’t the only reason that you;d get this exception since there are lots of loaders in this world that are both not named and not part of a web container internals. As long as the message doesn’t claim that the only thing that can wrong is a missing container TIM then I’m all for this
The message could allude to a missing TIM for sure. Of course this isn’t the only reason that you;d get this exception since there are lots of loaders in this world that are both not named and not part of a web container internals. As long as the message doesn’t claim that the only thing that can wrong is a missing container TIM then I’m all for this