<html><head></head><body 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><br>On Aug 28, 2012, at 9:25, Dan Berindei &lt;<a href="mailto:dan.berindei@gmail.com">dan.berindei@gmail.com</a>&gt; 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">&lt;<a href="mailto:ales.justin@gmail.com" target="_blank">ales.justin@gmail.com</a>&gt;</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>

&nbsp; &nbsp; &nbsp; &nbsp; at org.infinispan.query.impl.LifecycleManager.cacheStarted(LifecycleManager.java:125)<br>
&nbsp; &nbsp; &nbsp; &nbsp; at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:178) [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]<br>
&nbsp; &nbsp; &nbsp; &nbsp; at org.infinispan.CacheImpl.start(CacheImpl.java:523) [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]<br>
&nbsp; &nbsp; &nbsp; &nbsp; at org.infinispan.AbstractDelegatingCache.start(AbstractDelegatingCache.java:343) [infinispan-core-5.2.0.ALPHA2.jar:5.2.0.ALPHA2]<br>
&nbsp; &nbsp; &nbsp; &nbsp; at org.jboss.capedwarf.common.infinispan.InfinispanUtils.checkCache(InfinispanUtils.java:72) [capedwarf-common-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
&nbsp; &nbsp; &nbsp; &nbsp; 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>
&nbsp; &nbsp; private static &lt;K, V&gt; Cache&lt;K, V&gt; checkCache(String cacheName) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; final Cache&lt;K, V&gt; cache = cacheManager.getCache(cacheName, false);<br>
&nbsp; &nbsp; &nbsp; &nbsp; if (cache != null) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final ComponentStatus status = cache.getStatus();<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (status != ComponentStatus.INITIALIZING &amp;&amp; status != ComponentStatus.RUNNING) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cache.start();<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; &nbsp; }<br>
&nbsp; &nbsp; &nbsp; &nbsp; return cache;<br>
&nbsp; &nbsp; }<br>
<br>
Any other idea?<br>
<span class="HOEnZb"><font color="#888888"><br>
-Ales<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Aug 27, 2012, at 10:51 PM, Ales Justin &lt;<a href="mailto:ales.justin@gmail.com">ales.justin@gmail.com</a>&gt; wrote:<br>
<br>
&gt; OK, let me try this workaround.<br>
&gt;<br>
&gt; But should Cache::stop also remove it or not?<br>
&gt;<br>
&gt; If yes, I might dig deeper into finding the culprit,<br>
&gt; if not, then the workaround should do, I guess.<br>
&gt;<br>
&gt; -Ales<br>
&gt;<br>
&gt;&gt; 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>
&gt;&gt;<br>
&gt;&gt; On Aug 25, 2012, at 3:44 PM, Ales Justin wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; When running CapeDwarf tests these days I get this broken behavior:<br>
&gt;&gt;&gt; (using: Ispan 5.2.0.Alpha2)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On 1st test all works OK:<br>
&gt;&gt;&gt; * getting the X cache<br>
&gt;&gt;&gt; * passing it to SearchManager (from Ispan Query)<br>
&gt;&gt;&gt; * doing queries, etc<br>
&gt;&gt;&gt; * stopping the X cache on app (aka Arquillian test) undeploy<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; But when running 2nd app (more Arquillian tests) it breaks.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I'm again using X cache, via this lookup:<br>
&gt;&gt;&gt; (where toCacheName == X)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;final Cache&lt;K, V&gt; cache = cacheManager.getCache(toCacheName(config, appId), false);<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (cache != null)<br>
&gt;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return cache;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; And I actually get some cache, where I would expect none.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Since this cache is not new, it's never run against Ispan Query's LifecycleManager,<br>
&gt;&gt;&gt; hence there is no QueryInterceptor in its component registry.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Which is where the app breaks: SearchManager requires QueryInterceptor in cache' component registry.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Shouldn't Cache::stop also remove the cache from EmbeddedCacheManager?<br>
&gt;&gt;&gt; btw: this used to work, dunno when it broke ...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Anyone else seeing something similar?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; -Ales<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ----------<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; 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>

&gt;&gt;&gt; &nbsp; &nbsp; at org.infinispan.query.impl.ComponentRegistryUtils.getComponent(ComponentRegistryUtils.java:40)<br>
&gt;&gt;&gt; &nbsp; &nbsp; at org.infinispan.query.SearchManagerImpl.&lt;init&gt;(SearchManagerImpl.java:57)<br>
&gt;&gt;&gt; &nbsp; &nbsp; at org.infinispan.query.Search.getSearchManager(Search.java:39)<br>
&gt;&gt;&gt; &nbsp; &nbsp; at org.jboss.capedwarf.datastore.AbstractDatastoreService.&lt;init&gt;(AbstractDatastoreService.java:61) [capedwarf-datastore-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
&gt;&gt;&gt; &nbsp; &nbsp; at org.jboss.capedwarf.datastore.JBossDatastoreService.&lt;init&gt;(JBossDatastoreService.java:56) [capedwarf-datastore-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
&gt;&gt;&gt; &nbsp; &nbsp; at com.google.appengine.api.datastore.DatastoreServiceFactory.getDatastoreService(DatastoreServiceFactory.java) [appengine-api-1.0-sdk-1.7.0.jar:]<br>
&gt;&gt;&gt; &nbsp; &nbsp; at org.jboss.capedwarf.log.JBossLogService.requestStarted(JBossLogService.java:215) [capedwarf-log-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]<br>
&gt;<br>
<br>
<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>
</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">infinispan-dev@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/infinispan-dev">https://lists.jboss.org/mailman/listinfo/infinispan-dev</a></span></div></blockquote></body></html>