2016-09-16 64 views
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) 

回答

2

这已经是固定的,而修补程序将包含在点燃1.8:https://issues.apache.org/jira/browse/IGNITE-3634

+0

大...作为替代我使用@Cacheable(值=“信道”,除非=“#result = = null“)。你能建议任何其他/更好的选择 –

+0

这将删除异常,但'null'值仍然不会被缓存。这意味着下次您调用此方法时,您将再次执行该方法。但我认为在1.7版本中没有一个清晰的解决方法。 –

+0

好吧......我可以忍受这一点,直到1.8发布。你能告诉我1.8版本的发布日期吗? –

相关问题