org.springframework.expression.spel.SpelEvaluationException: EL1030E
问题与分析
在本地开发项目时发现报错如下:
org.springframework.expression.spel.SpelEvaluationException: EL1030E: The operator 'ADD' is not supported between objects of type 'java.lang.String' and 'null'
at org.springframework.expression.spel.ExpressionState.operate(ExpressionState.java:240)
at org.springframework.expression.spel.ast.OpPlus.getValueInternal(OpPlus.java:80)
at org.springframework.expression.spel.ast.OpPlus.getValueInternal(OpPlus.java:85)
at org.springframework.expression.spel.ast.OpPlus.getValueInternal(OpPlus.java:83)
at org.springframework.expression.spel.ast.OpPlus.getValueInternal(OpPlus.java:83)
at org.springframework.expression.spel.ast.OpPlus.getValueInternal(OpPlus.java:83)
at org.springframework.expression.spel.ast.OpPlus.getValueInternal(OpPlus.java:83)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:109)
at org.springframework.expression.spel.standard.SpelExpression.getValue
....
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
从堆栈信息可以看出,该异常与spel有关。spel指的是Spring Expression Language,结合问题代码进行分析,可以认为该异常与spring表达式有关。而在我的代码里,只有@Cacheable注解里使用到了spel,如下:
@Cacheable(key = "#root.target.getCacheKeyPrefix() + '::' + + #root.target.getRootDomain() + '-' + #root.target.getLocale() + '-' + #searchLabelKey")
public String getFromRootDomain(final String labelId, final String locale, final String searchLabelKey) {
// TODO
return null;
}
很显然,在使用到该注解时,由于这里的spring表达式有问题,最终在解析时抛出了异常。经过检查发现,这里犯了个很逗的错误,就是连续使用了两个+,导致解析无法通过,改正后如下:
@Cacheable(key = "#root.target.getCacheKeyPrefix() + '::' + #root.target.getRootDomain() + '-' + #root.target.getLocale() + '-' + #searchLabelKey")
而之所以之前没能发现这个问题,是因为没有启用redis cache,导致避开了这个问题。目前刚开始了解spel这门表达式语言,在此记录下这个问题,方便日后回顾分析,下面顺便贴上官方的一篇中译文档。
参考链接
org.springframework.expression.spel.SpelEvaluationException: EL1030E的更多相关文章
- org.springframework.expression.spel.SpelEvaluationException: EL1005E:(pos 0): Type cannot be found
今天在完成Spring项目的时候遇到了一个类似于下面的异常: 10.03.2010 13:53:53 org.apache.catalina.core.StandardWrapperValve inv ...
- org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call method test() on null context object
前言 本文中提到的解决方案,源码地址在:springboot-thymeleaf,希望可以帮你解决问题. 至于为什么已经写了一篇文章thymeleaf模板引擎调用java类中的方法,又多此一举的单独整 ...
- org.springframework.expression.spel.SpelEvaluationException: EL1004E: Method call: Method service() cannot be found on com.my.blog.springboot.thymeleaf.util.MethodTest type
前言 本文中提到的解决方案,源码地址在:springboot-thymeleaf,希望可以帮你解决问题. 至于为什么已经写了一篇文章thymeleaf模板引擎调用java类中的方法,又多此一举的单独整 ...
- 【spring data jpa】使用jpa的@Query,自己写的语句,报错:org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'status' cannot be found on null
报错: org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'status' ...
- 【spring data jpa】jpa中使用in查询或删除 在@Query中怎么写 ,报错:org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'goodsConfigUid' cannot be found on null 怎么处理
示例代码如下: @Modifying @Transactional @Query("delete from GoodsBindConfigMapping gbc " + " ...
- spring-boot 集成ehcache报错:org.springframework.expression.spel.SpelEvaluationException: EL1008E:
错误信息:org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'pageab ...
- Caused by: java.lang.ClassNotFoundException: org.springframework.expression.ExpressionParser
1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...
- java.lang.NoClassDefFoundError: org/springframework/expression/PropertyAccessor
这个异常原因种类不一,网上有各个版本,本人的是因为缺少了spring-expression-3.2.1.RELEASE.jar 2015-9-18 23:19:11 org.apache.catali ...
- 异常:java.lang.NoClassDefFoundError: org/springframework/expression/ParserContext
异常:java.lang.NoClassDefFoundError: org/springframework/expression/ParserContext 解决方案:缺少spring-expres ...
随机推荐
- 元素的colspan和rowspan
colspan和rowspan这两个属性用于创建特殊的表格. colspan用来指定单元格横向跨越的列数:colspan就是合并列的,colspan=2就是合并两列. rowspan用来指定单元格纵向 ...
- 【转载】 Asp.Net安全之防止脚本入
在ASP.NET开发过程中,安全性是必须要重中之重需要考虑的,其中一种情况是要防止用户输入恶意脚本入侵的情况,恶意脚本入侵指的是用户在提交内容中提交了包含特殊Javascript脚本程序等非法信息,如 ...
- 【转载】C#指定文件夹下面的所有内容复制到目标文件夹下面
在涉及到文件夹操作的过程中,有时候需要将文件夹下的所有内容复制拷贝到另一个文件夹,在C#的开发中有时候会遇到这个功能需求将指定文件夹下所有的内容复制到另一个文件夹,这个过程需要遍历所有的文件和目录.此 ...
- Linux基础命令汇总109条
1 文件管理 1.1 basename 1.1.1 功能说明 从文件名中去掉路径和扩展名 例:basename include/stdio.h .h Output &quo ...
- Vue指令之`v-bind`的三种用法及v-on事件指令
v-bind:是 Vue中,提供的用于绑定属性的指令 1. 直接使用指令`v-bind` 2. 使用简化指令`:` 3. 在绑定的时候,拼接绑定内容:`:title="btnTitle + ...
- java中javamail收发邮件实现方法
概述 1.邮件相关的标准 厂商所提供的 JavaMail 服务程序可以有选择地实现某些邮件协议,常见的邮件协议包括: SMTP(Simple Mail Transfer Protocol) :即简单邮 ...
- thefuck安装和使用(ubuntu)
系统环境(已测试可用): ubuntu 18.04 lts (server或desktop),ubuntu 19.04(server或desktop) sudo apt update sudo apt ...
- Python中type()详解:动态创建类
众所周知: type()函数可以查看变量的类型: 先看一个简单的列子来看一下type查看变量类型 class Animal(): pass a=Animal() print(type(a)) prin ...
- PS批量制作获奖证书并导出PNG
其实方法和"使用PS批量制作视频字幕"的方法类似.区别在于制作视频字幕时导出成psd格式就可以直接导入Premiere中使用了,而获奖证书考虑到打印设备有无PS的不确定性,可能需要 ...
- php遍历目录与文件夹的多种方法详解
遍历目录或遍历目录下指定类型的文件,这是每一个童鞋在写程序的时候难免会用到的.PHP本身也提供了很多灰常有用的函数,正确地使用它们,不会有错滴.下面就我个人学习过程中的一些总结,希望对想学PHP的童鞋 ...