ICEPush: BeanItemContainer looks for non existent classes

Hi,

my application is showing two tables. One is backed by a BeanItemConatiner and one is backed by a LazyQueryContainer. I’m using ICEPush to show updates in the UI that were detected by a separate thread. When the thread has detected an update and ICEPush.push() is called, the two tables will be updated by creating new conatiners (the two mentioned above) and assigning them to the tables via Table.setContainerDataSource().
The LazyQueryContainer is updating just fine but the BeanItemContainer is causing a java.lang.IllegalStateException. The funny thing is, that this exception is thrown because two non existent classes couldn’t be loaded. To give more details, here are the class names I use:


de.test.bean.SampleBean
- bean class the BeanItemContainer is serving
de.test.container.SampleBeanContainer - BeanItemContainer serving the SampleBean

The two classes
de.test.bean.SampleBeanBeanInfo
and
de.test.bean.SampleBeanCustomizer
couldn’t be found, which makes sense, since they don’t exist! But why are they looked for?

Excerpt from the log:

Information: Illegal access: this web application instance has been stopped already. 
Could not load [b]
de.test.bean.SampleBeanBeanInfo
[/b].  The eventual following stack trace
is caused by an error thrown for debugging purposes as well as to attempt to terminate the 
thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1597)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at com.sun.beans.finder.ClassFinder.findClass(ClassFinder.java:99)
	at com.sun.beans.finder.InstanceFinder.instantiate(InstanceFinder.java:93)
	at com.sun.beans.finder.InstanceFinder.find(InstanceFinder.java:66)
	at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:436)
	at java.beans.Introspector.<init>(Introspector.java:386)
	at java.beans.Introspector.getBeanInfo(Introspector.java:161)
	at com.vaadin.data.util.BeanItem.getBeanPropertyDescriptor(BeanItem.java:222)
	at com.vaadin.data.util.BeanItem.getPropertyDescriptors(BeanItem.java:169)
	at com.vaadin.data.util.AbstractBeanContainer.<init>(AbstractBeanContainer.java:168)
	at com.vaadin.data.util.BeanContainer.<init>(BeanContainer.java:76)
	at de.test.container.SampleBeanContainer.<init>(SampleBeanContainer.java:51)

and

Information: Illegal access: this web application instance has been stopped already. 
Could not load [b]
de.test.bean.SampleBeanCustomizer
[/b].  The eventual following stack trace
is caused by an error thrown for debugging purposes as well as to attempt to terminate the 
thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1597)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at com.sun.beans.finder.ClassFinder.findClass(ClassFinder.java:99)
	at com.sun.beans.finder.InstanceFinder.instantiate(InstanceFinder.java:93)
	at com.sun.beans.finder.InstanceFinder.find(InstanceFinder.java:66)
	at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:436)
	at java.beans.Introspector.<init>(Introspector.java:386)
	at java.beans.Introspector.getBeanInfo(Introspector.java:161)
	at com.vaadin.data.util.BeanItem.getBeanPropertyDescriptor(BeanItem.java:222)
	at com.vaadin.data.util.BeanItem.getPropertyDescriptors(BeanItem.java:169)
	at com.vaadin.data.util.AbstractBeanContainer.<init>(AbstractBeanContainer.java:168)
	at com.vaadin.data.util.BeanContainer.<init>(BeanContainer.java:76)
	at de.test.container.SampleBeanContainer.<init>(SampleBeanContainer.java:51)

These methods are also called when the user clicks in the UI and an update is fired and there is no error at all.

To make it even weird, the IllegalStateException is not always thrown, but I couldn’t figure out a pattern when this happens or not.

Any help/hint is much appreciated

Andreas

The *BeanInfo and *Customizer classes are part of the JavaBeans specification: see
here
.

Bean types used in BeanItemContainer are analyzed with java.beans.Introspector, which looks for these classes. At least some results of the analysis are cached for the next time, but I haven’t checked which JREs cache what. That might explain why you don’t always get these.

Which JRE version and build are you using? Which Tomcat (or other server) version?

At least JRE 1.6.0.26 does not contain the class com.sun.beans.finder.InstanceFinder and does catch these exceptions cleanly within Introspector.findExplicitBeanInfo(), but maybe your JRE or server (Tomcat?) classloader behave differently.

EDIT: Just to clarify: those classes are optional based on the spec (very rarely used nowadays) and them being missing should simply be ignored by the JRE.

Hi Henri,

thank you for your answer. I use normally Tomcat 7.0.28 for developing and with this Tomcat version I encountered the problem first. I did some more testing/debugging and used Tomcat 6.0.30: I had no problem at all with this version! Both Tomcat versions used JDK 1.7u5.

Since I want to use current versions of JDK and Tomcat for my app, how can I disable/suppress the IllegalStateException? I googled it but couldn’t find a solution.

Best regards

Andreas

I just tried Tomcat 7.0.28 with JDK 1.6u25: Exception. Tomcat 6.0.30 with JDK 1.7u5 no exception at all.

I think it’s a problem of Tomcat…