java – 使用Ehcache弹出@Cacheable,spel为有效对象找到null
作者:互联网
我有一个类似的problem,但有时它的工作原理.描述的错误只会偶尔发生一次.
我使用的是spring 3.2.5和ehcache 2.6.5.
异常跟踪:
org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Field or property 'applicationID' cannot be found on null
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:213)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:85)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:43)
at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:346)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:89)
at org.springframework.cache.interceptor.ExpressionEvaluator.key(ExpressionEvaluator.java:95)
at org.springframework.cache.interceptor.CacheAspectSupport$CacheOperationContext.generateKey(CacheAspectSupport.java:452)
at org.springframework.cache.interceptor.CacheAspectSupport.inspectCacheables(CacheAspectSupport.java:281)
at org.springframework.cache.interceptor.CacheAspectSupport.execute(CacheAspectSupport.java:199)
at org.springframework.cache.interceptor.CacheInterceptor.invoke(CacheInterceptor.java:66)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy85.getMailOrigin(Unknown Source)
at com.myApplication.MailFilterServiceImpl.isValid(ApplicationServiceImpl.java:134)
我的缓存代码如下:
MailFilterServiceImpl
@Cacheable(value="mailClientsCache", key="#mb.applicationID")
public MailClientBean getMailOrigin(MailBean mb){}
当这件事发生时:
当我有一个jenkins配置为构建和自动部署到tomcat7 /当我使用maven在eclipse中构建并部署到tomcat7时.
当这完美地工作:
在失败一次之后,如果我只是用一些空格编辑MailFilterServiceImpl.java以使其在eclipse中重新编译并重新启动tomcat7服务器.
我需要让它在CI场景中运行.
[更新]
设置编译器选项debug:true可解决此问题.优化似乎没有任何发言权.
<debug>true</debug>
<optimize>true</optimize>
解决方法:
您的描述清楚地表明:使用javac进行编译时它不起作用,但它确实与Eclipse编译器ecj一起使用.您可能正在编译而没有调试信息.
标签:spring-cache,java,spring,ehcache 来源: https://codeday.me/bug/20190928/1825856.html