Close

How to fix javax.el.ELException: The identifier [class] is not a valid Java identifier..?

[Last Updated: Jan 18, 2017]

JSP JAVA EE 

The Exception:

javax.el.ELException: The identifier [class] 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.

org.apache.el.parser.AstDotSuffix.setImage(AstDotSuffix.java:46)

org.apache.el.parser.ELParser.DotSuffix(ELParser.java:1069)

org.apache.el.parser.ELParser.ValueSuffix(ELParser.java:1035)

........................

The Code:

This is the JSP page which caused above error:

<%@ page language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<html>
<body>
<h3>This is custom exception page</h3>
<p>Exception Type: <b>${exception.class.simpleName}</b></p>
<p>Exception Message: <b>${exception.message}</b></p>

</body>
</html>


The Fix:

Replace

${exception.class.simpleName}

with

${exception['class'].simpleName}

<%@ page language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<html>
<body>
<h3>This is custom exception page</h3>
<p>Exception Type: <b>${exception['class'].simpleName}</b></p>
<p>Exception Message: <b>${exception.message}</b></p>
</body>
</html>

See Also