[infinispan-issues] [JBoss JIRA] (ISPN-3032) Use both context and class' class loader when reading component metadata
Bert Jacobs (JIRA)
jira-events at lists.jboss.org
Tue May 7 11:00:55 EDT 2013
[ https://issues.jboss.org/browse/ISPN-3032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12772775#comment-12772775 ]
Bert Jacobs commented on ISPN-3032:
-----------------------------------
I've ran into this problem using JBoss EAP 5 and a private classloader to get Modeshape running, but I'd think you would also see it if Infinispan is ever ran in OSGi.
Either you could try to query a number of ClassLoaders or you could even pass Class objects on which you can call .getResource("/file.dat"), as suggested in [http://njbartlett.name/2012/10/23/dreaded-thread-context-classloader.html]. Of course, this assumes you know that a given class file is always packaged in the same JAR file as the dat file.
> Use both context and class' class loader when reading component metadata
> ------------------------------------------------------------------------
>
> Key: ISPN-3032
> URL: https://issues.jboss.org/browse/ISPN-3032
> Project: Infinispan
> Issue Type: Enhancement
> Reporter: Mircea Markus
> Assignee: Mircea Markus
> Priority: Minor
>
> {quote}
> Caused by: org.hibernate.search.SearchException: Unable to initialize
> directory provider:
> org.hibernate.search.test.integration.jbossas7.model.Member
> at org.hibernate.search.store.impl.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:87)
> at org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.createDirectoryProvider(DirectoryBasedIndexManager.java:232)
> at org.hibernate.search.indexes.impl.DirectoryBasedIndexManager.initialize(DirectoryBasedIndexManager.java:100)
> at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:227)
> ... 19 more
> Caused by: org.infinispan.config.ConfigurationException:
> org.infinispan.CacheException: Unable to load component metadata!
> at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:386)
> at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:341)
> at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:328)
> at org.hibernate.search.infinispan.CacheManagerServiceProvider.start(CacheManagerServiceProvider.java:93)
> at org.hibernate.search.engine.impl.StandardServiceManager$ServiceProviderWrapper.startVirtual(StandardServiceManager.java:178)
> at org.hibernate.search.engine.impl.StandardServiceManager.requestService(StandardServiceManager.java:124)
> at org.hibernate.search.infinispan.impl.InfinispanDirectoryProvider.initialize(InfinispanDirectoryProvider.java:86)
> at org.hibernate.search.store.impl.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:84)
> ... 22 more
> Caused by: org.infinispan.CacheException: Unable to load component metadata!
> at org.infinispan.factories.components.ComponentMetadataRepo.initialize(ComponentMetadataRepo.java:131)
> at org.infinispan.factories.GlobalComponentRegistry.<init>(GlobalComponentRegistry.java:103)
> at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:381)
> ... 29 more
> Caused by: java.lang.NullPointerException
> at org.infinispan.factories.components.ComponentMetadataRepo.readMetadata(ComponentMetadataRepo.java:53)
> at org.infinispan.factories.components.ComponentMetadataRepo.initialize(ComponentMetadataRepo.java:129)
> ... 31 more
> {quote}
> The exception above is caused by Infinispan using (by default) invocation context's ClassLoader when trying to read the component metadata. In a modularized environment such as AS7 this will cause the metadata not to be found (metadata is packaged in the same jar as the infinispan class that reads it). In order to overcome this problem we should try to use both class' ClassLoader and InvocationContxt's class loader when trying to read the metadata.
> Workaround: set the class loader on the GlobalConfiguration object:
> {code:java}
> GlobalConfiguration.classLoader( GlobalConfiguration.class.getClassLoder())
> {code}
--
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