NutzCN Logo
问答 求教使用@CacheResult注解设置缓存问题
发布于 280天前 作者 baocj 570 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

同时调用五个接口,不使用@CacheResult注解设置缓存不会报错,使用后接口会报异常,异常信息如下:

[ERROR] 20:08:06.126 [qtp1671590089-171] cn.wizzer.app.web.modules.controllers.platform.mbr.MbrConsumerController - null
java.lang.ArrayIndexOutOfBoundsException: null
	at java.lang.reflect.Array.get(Native Method)
	at org.nutz.el.opt.object.ArrayOpt.calculate(ArrayOpt.java:35)
	at org.nutz.el.opt.object.FetchArrayOpt.calculate(FetchArrayOpt.java:23)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:55)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:38)
	at org.nutz.el.El.eval(El.java:36)
	at org.nutz.plugins.wkcache.WkcacheResultInterceptor.filter(WkcacheResultInterceptor.java:50)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.wizzer.app.mbr.modules.services.impl.MbrConsumerServiceImpl$$NUTZAOP.projectOverView(MbrConsumerServiceImpl.java:1)
	at com.alibaba.dubbo.common.bytecode.Wrapper80.invokeMethod(Wrapper80.java)
	at com.alibaba.dubbo.rpc.proxy.javassist.JavassistProxyFactory$1.doInvoke(JavassistProxyFactory.java:47)
	at com.alibaba.dubbo.rpc.proxy.AbstractProxyInvoker.invoke(AbstractProxyInvoker.java:76)
	at com.alibaba.dubbo.config.invoker.DelegateProviderMetaDataInvoker.invoke(DelegateProviderMetaDataInvoker.java:52)
	at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56)
	at com.alibaba.dubbo.rpc.filter.ExceptionFilter.invoke(ExceptionFilter.java:62)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.csp.sentinel.adapter.dubbo.SentinelDubboProviderFilter.invoke(SentinelDubboProviderFilter.java:68)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:75)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.filter.TimeoutFilter.invoke(TimeoutFilter.java:42)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:73)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:138)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:38)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at com.alibaba.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:104)
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:96)
	at com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:173)
	at com.alibaba.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
	at com.alibaba.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:748)

注解写法:

 @CacheResult(cacheKey = "${args[0]}_projectOverView")
    public Object projectOverView(List<Long> projectIds)
6 回复

projectIds为空数组?

@wendal 数组是有值的,去掉注解不会出错,有注解也是偶然会出上述异常,不是每次都出来

来自炫酷的 NutzCN

@wendal 怪就是偶尔会出现,没有规律

来自炫酷的 NutzCN

所以你需要找到规律了

cacheKey 可以不设置,自动创建 cacheKey

然后你就可以在redis里看看 cacheKey 里的传参到底是什么了

添加回复
请先登陆
回到顶部