项目环境:
Intellij IDEA+Maven+Testng+SpringMVC+MyBatis+Tomcat 9+Oracle
问题:
启动tomcat9服务,进行某具体的按钮操作时,例如“修改”时,debug查看后台报错:
22-Apr-2018 10:42:39.434 严重 [http-nio-8088-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [SpringMVC] in context with path [] threw exception [org.apache.jasper.JasperException: javax.el.ELException: Failed to parse the expression [${case.uuid}]] with root cause
javax.el.ELException: The identifier [case] is not a valid Java identifier as required by section 1.19 of the EL specification (Identifier ::= Java language identifier). This check can be disabled by setting the system property org.apache.el.parser.SKIP_IDENTIFIER_CHECK to true.
at org.apache.el.parser.AstIdentifier.setImage(AstIdentifier.java:177)
at org.apache.el.parser.ELParser.Identifier(ELParser.java:1816)
at org.apache.el.parser.ELParser.NonLiteral(ELParser.java:1548)
at org.apache.el.parser.ELParser.ValuePrefix(ELParser.java:1369)
at org.apache.el.parser.ELParser.Value(ELParser.java:1316)
at org.apache.el.parser.ELParser.Unary(ELParser.java:1298)
at org.apache.el.parser.ELParser.Multiplication(ELParser.java:1060)
at org.apache.el.parser.ELParser.Math(ELParser.java:980)
at org.apache.el.parser.ELParser.Concatenation(ELParser.java:936)
at org.apache.el.parser.ELParser.Compare(ELParser.java:747)
at org.apache.el.parser.ELParser.Equality(ELParser.java:641)
at org.apache.el.parser.ELParser.And(ELParser.java:585)
at org.apache.el.parser.ELParser.Or(ELParser.java:529)
at org.apache.el.parser.ELParser.Choice(ELParser.java:486)
at org.apache.el.parser.ELParser.Assignment(ELParser.java:243)
at org.apache.el.parser.ELParser.Semicolon(ELParser.java:182)
at org.apache.el.parser.ELParser.Expression(ELParser.java:175)
at org.apache.el.parser.ELParser.DynamicExpression(ELParser.java:147)
at org.apache.el.parser.ELParser.CompositeExpression(ELParser.java:44)
at org.apache.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:118)
at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:178)
at org.apache.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:242)
at org.apache.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:67)
at org.apache.jasper.compiler.Validator$ValidateVisitor.prepareExpression(Validator.java:1624)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:753)
at org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:958)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2389)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2441)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2447)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:470)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2389)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1856)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:224)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:385)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:362)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:346)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:712)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:459)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:384)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1286)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1041)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:984)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:417)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
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:748)
解决方案:
1、找到当前使用的tomcat所在位置下的conf/catalina.properties文件,不要弄错了,不是项目发布在tomcat对应的目录
2、在该文件的末尾加上以下内容并保存
org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
org.apache.el.parser.SKIP_IDENTIFIER_CHECK=true
3、重启tomcat,再次访问就Ok了。