[infinispan-issues] [JBoss JIRA] (ISPN-3099) Util.loadClass() still swallows NoClassDefFoundError

Bert Jacobs (JIRA) jira-events at lists.jboss.org
Tue May 14 09:39:06 EDT 2013


     [ https://issues.jboss.org/browse/ISPN-3099?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bert Jacobs updated ISPN-3099:
------------------------------

    Attachment: report-infinispan-logging.patch

    
> Util.loadClass() still swallows NoClassDefFoundError
> ----------------------------------------------------
>
>                 Key: ISPN-3099
>                 URL: https://issues.jboss.org/browse/ISPN-3099
>             Project: Infinispan
>          Issue Type: Feature Request
>          Components: Core API
>    Affects Versions: 5.2.5.Final
>         Environment: Windows, JBoss EAP 5
>            Reporter: Bert Jacobs
>            Assignee: Mircea Markus
>         Attachments: report-infinispan-logging.patch
>
>
> My log contains stack traces like the following:
> {code}
> Caused by: org.infinispan.CacheConfigurationException: Unable to instantiate class org.infinispan.loaders.bdbje.BdbjeCacheStore
> 	at org.infinispan.util.Util.loadClass(Util.java:101)
> 	at org.infinispan.util.Util.getInstance(Util.java:222)
> 	at org.infinispan.configuration.parsing.Parser51.parseLoader(Parser51.java:440)
> 	at org.infinispan.configuration.parsing.Parser51.parseLoaders(Parser51.java:418)
> 	at org.infinispan.configuration.parsing.Parser51.parseCache(Parser51.java:189)
> 	at org.infinispan.configuration.parsing.Parser51.parseNamedCache(Parser51.java:148)
> 	at org.infinispan.configuration.parsing.Parser51.readElement(Parser51.java:115)
> 	at org.infinispan.configuration.parsing.Parser51.readElement(Parser51.java:84)
> 	at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
> 	at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
> 	at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:77)
> 	... 73 more
> Caused by: java.lang.ClassNotFoundException: org.infinispan.loaders.bdbje.BdbjeCacheStore
> 	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> 	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:249)
> 	at org.infinispan.util.Util.loadClassStrict(Util.java:138)
> 	at org.infinispan.util.Util.loadClass(Util.java:99)
> 	... 83 more
> {code}
> However, this ClassNotFoundException comes from the System classloader, but the code still swallows the following Error:
> {code}
> Caused by: org.infinispan.CacheConfigurationException: Unable to instantiate class org.infinispan.loaders.bdbje.BdbjeCacheStore
> 	at org.infinispan.util.Util.loadClass(Util.java:101)
> [SNIP - see above]
> 	at org.infinispan.configuration.parsing.ParserRegistry.parse(ParserRegistry.java:77)
> 	... 73 more
> Caused by: java.lang.ClassNotFoundException: org.infinispan.loaders.bdbje.BdbjeCacheStore
> 	at org.infinispan.util.Util.loadClassStrict(Util.java:150)
> 	at org.infinispan.util.Util.loadClass(Util.java:99)
> 	... 83 more
> Caused by: java.lang.NoClassDefFoundError: com/sleepycat/collections/TransactionWorker
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:249)
> 	at org.infinispan.util.Util.loadClassStrict(Util.java:138)
> 	... 84 more
> Caused by: java.lang.ClassNotFoundException: com.sleepycat.collections.TransactionWorker from BaseClassLoader at 3598d24f{vfsfile:/D:/App/Java/jboss/brms-standalone-5.3.0/jboss-as/server/lettergen-ds-default/deploy/modeshape-datastore.ear/}
> 	at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:477)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> 	... 87 more
> {code}
> It is this error which is actually important: the BdbjeCacheStore class was found but it cannot be loaded because the sleepycat jar is not on the classpath. It is impossible to see this without changing the code.
> The commits for ISPN-2559 did not properly fix this problem. The Error should be logged in all cases because the ClassNotFoundException will also happen in almost every case: the last search ClassLoader is the System ClassLoader which will likely never have the searched class.
> Once again: please log all NoClassDefFoundErrors (suppressing Errors is bad in any case) or at least handle them *before* handling any ClassNotFoundExceptions. The attached patch does exactly that.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the infinispan-issues mailing list