That's the NPE I was talking about, the CommandInitializer *should* be registered again by the ComponentRegistry constructor so the initializer variable shouldn't be null... <br><br>I can't say why that doesn't happen, though. Could you try with an Infinispan-only test?<br>
<br><br><div class="gmail_quote">On Tue, Aug 28, 2012 at 11:10 AM, Ales Justin <span dir="ltr"><<a href="mailto:ales.justin@gmail.com" target="_blank">ales.justin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF"><div>NPE is thrown at diff place; see #125 line in LM class.</div><div>No initializer is found, hence NPE on initializer::initialize(Cache).<br><br>Sent from my iPad</div><div><div class="h5"><div><br>
On Aug 28, 2012, at 9:25, Dan Berindei <<a href="mailto:dan.berindei@gmail.com" target="_blank">dan.berindei@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>Cache.stop() should not remove the cache from the cache manager. <br>
<br>But AFAIK the ComponentRegistry that holds all the cache-scoped components is destroyed, and recreated by Cache.start(). In the constructor it should register Query's CommandInitializer again, so LifecycleManager should find it and you shouldn't get the NPE...<br>
<br>Dan<br><br><br><div class="gmail_quote">On Tue, Aug 28, 2012 at 12:15 AM, Ales Justin <span dir="ltr"><<a href="mailto:ales.justin@gmail.com" target="_blank">ales.justin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Uh, the workaround results in NPE:<br>
<br>
23:10:27,160 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]] (http-/192.168.1.101:8080-2) Exception sending request initialized lifecycle event to listener instance of class org.jboss.capedwarf.appidentity.GAEListener: java.lang.NullPointerException<br>
at org.infinispan.query.impl.LifecycleManager.cacheStarted(LifecycleManager.java:125)<br>
at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:178) [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]<br>
at org.infinispan.CacheImpl.start(CacheImpl.java:523) [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]<br>
at org.infinispan.AbstractDelegatingCache.start(AbstractDelegatingCache.java:343) [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]<br>
at org.jboss.capedwarf.common.infinispan.InfinispanUtils.checkCache(InfinispanUtils.java:72) [capedwarf-common-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
at org.jboss.capedwarf.common.infinispan.InfinispanUtils.getCache(InfinispanUtils.java:82) [capedwarf-common-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
<br>
This is the code I added:<br>
<br>
private static <K, V> Cache<K, V> checkCache(String cacheName) {<br>
final Cache<K, V> cache = cacheManager.getCache(cacheName, false);<br>
if (cache != null) {<br>
final ComponentStatus status = cache.getStatus();<br>
if (status != ComponentStatus.INITIALIZING && status != ComponentStatus.RUNNING) {<br>
cache.start();<br>
}<br>
}<br>
return cache;<br>
}<br>
<br>
Any other idea?<br>
<span><font color="#888888"><br>
-Ales<br>
</font></span><div><div><br>
On Aug 27, 2012, at 10:51 PM, Ales Justin <<a href="mailto:ales.justin@gmail.com" target="_blank">ales.justin@gmail.com</a>> wrote:<br>
<br>
> OK, let me try this workaround.<br>
><br>
> But should Cache::stop also remove it or not?<br>
><br>
> If yes, I might dig deeper into finding the culprit,<br>
> if not, then the workaround should do, I guess.<br>
><br>
> -Ales<br>
><br>
>> As a workaround, couldn't you check what the status of the cache is before using it? If it's stopped, you could call cache.start() again.<br>
>><br>
>> On Aug 25, 2012, at 3:44 PM, Ales Justin wrote:<br>
>><br>
>>> When running CapeDwarf tests these days I get this broken behavior:<br>
>>> (using: Ispan 5.2.0.Alpha2)<br>
>>><br>
>>> On 1st test all works OK:<br>
>>> * getting the X cache<br>
>>> * passing it to SearchManager (from Ispan Query)<br>
>>> * doing queries, etc<br>
>>> * stopping the X cache on app (aka Arquillian test) undeploy<br>
>>><br>
>>> But when running 2nd app (more Arquillian tests) it breaks.<br>
>>><br>
>>> I'm again using X cache, via this lookup:<br>
>>> (where toCacheName == X)<br>
>>><br>
>>> final Cache<K, V> cache = cacheManager.getCache(toCacheName(config, appId), false);<br>
>>> if (cache != null)<br>
>>> return cache;<br>
>>><br>
>>> And I actually get some cache, where I would expect none.<br>
>>><br>
>>> Since this cache is not new, it's never run against Ispan Query's LifecycleManager,<br>
>>> hence there is no QueryInterceptor in its component registry.<br>
>>><br>
>>> Which is where the app breaks: SearchManager requires QueryInterceptor in cache' component registry.<br>
>>><br>
>>> Shouldn't Cache::stop also remove the cache from EmbeddedCacheManager?<br>
>>> btw: this used to work, dunno when it broke ...<br>
>>><br>
>>> Anyone else seeing something similar?<br>
>>><br>
>>> -Ales<br>
>>><br>
>>> ----------<br>
>>><br>
>>> 15:32:06,810 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host]] (http-/192.168.1.101:8080-3) Exception sending request initialized lifecycle event to listener instance of class org.jboss.capedwarf.appidentity.GAEListener: java.lang.IllegalArgumentException: Indexing was not enabled on this cache. class org.infinispan.query.backend.QueryInterceptor not found in registry<br>
>>> at org.infinispan.query.impl.ComponentRegistryUtils.getComponent(ComponentRegistryUtils.java:40)<br>
>>> at org.infinispan.query.SearchManagerImpl.<init>(SearchManagerImpl.java:57)<br>
>>> at org.infinispan.query.Search.getSearchManager(Search.java:39)<br>
>>> at org.jboss.capedwarf.datastore.AbstractDatastoreService.<init>(AbstractDatastoreService.java:61) [capedwarf-datastore-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
>>> at org.jboss.capedwarf.datastore.JBossDatastoreService.<init>(JBossDatastoreService.java:56) [capedwarf-datastore-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
>>> at com.google.appengine.api.datastore.DatastoreServiceFactory.getDatastoreService(DatastoreServiceFactory.java) [appengine-api-1.0-sdk-1.7.0.jar:]<br>
>>> at org.jboss.capedwarf.log.JBossLogService.requestStarted(JBossLogService.java:215) [capedwarf-log-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
><br>
<br>
<br>
_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br>
</div></div></blockquote></div><br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>infinispan-dev mailing list</span><br><span><a href="mailto:infinispan-dev@lists.jboss.org" target="_blank">infinispan-dev@lists.jboss.org</a></span><br>
<span><a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></span></div></blockquote></div></div></div><br>_______________________________________________<br>
infinispan-dev mailing list<br>
<a href="mailto:infinispan-dev@lists.jboss.org">infinispan-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a><br></blockquote></div><br>