0
嗨我在我的春天的應用程序中使用Apache點燃。 當一個服務請求與放慢參數在數據庫中存在這並不它拋出異常Apache Ignite沒有更新空值的緩存
@Override
@Cacheable(value = "channel")
public Channel getChannelByCode(long ChannelCode) {
Query<Channel> query = channelDao.createQuery();
query.filter(Channel.mongoChannelCode, ChannelCode);
return channelDao.findOne(query);
}
當
channelDao.findOne(query);
返回空點燃拋出空指針異常
製成。以下是堆棧跟蹤。
threw exception [Request processing failed; nested exception is java.lang.NullPointerException: Ouch! Argument cannot be null: val] with root cause
java.lang.NullPointerException: Ouch! Argument cannot be null: val
at org.apache.ignite.internal.util.GridArgumentCheck.notNull(GridArgumentCheck.java:48)
at org.apache.ignite.internal.util.GridArgumentCheck.notNull(GridArgumentCheck.java:61)
at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.putAsync0(GridDhtAtomicCache.java:481)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.putAsync(GridCacheAdapter.java:2541)
at org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridDhtAtomicCache.put(GridDhtAtomicCache.java:460)
at org.apache.ignite.internal.processors.cache.GridCacheAdapter.put(GridCacheAdapter.java:2215)
at org.apache.ignite.internal.processors.cache.IgniteCacheProxy.put(IgniteCacheProxy.java:1214)
at org.apache.ignite.cache.spring.SpringCache.put(SpringCache.java:71)
at org.springframework.cache.interceptor.AbstractCacheInvoker.doPut(AbstractCacheInvoker.java:82)
at org.springframework.cache.interceptor.CacheAspectSupport$CachePutRequest.apply(CacheAspectSupport.java:626)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:340)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:281)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy171.getChannelByCode(Unknown Source)
at in.til.tp.commonpage.controller.BadgeController.getUserBadges(BadgeController.java:497)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
大...作爲替代我使用@Cacheable(值=「信道」,除非=「#result = = null「)。你能建議任何其他/更好的選擇 –
這將刪除異常,但'null'值仍然不會被緩存。這意味着下次您調用此方法時,您將再次執行該方法。但我認爲在1.7版本中沒有一個清晰的解決方法。 –
好吧......我可以忍受這一點,直到1.8發佈。你能告訴我1.8版本的發佈日期嗎? –