I have randomly started to get
"javax.el.ELException:"
error in jsp pages where we load the Java code. The same was working earlier but started to give this error randomly. Have tried building with different versions of JDK, tomcat and maven but the problem still persist. Any leads will be appreciated. Find the logs below:
Mar 05, 2014 3:22:31 PM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception javax.el.ELException: Cannot convert abcCache of type class java.lang.String to class java.lang.Class at org.apache.el.lang.ELSupport.coerceToType(ELSupport.java:420) at org.apache.el.ExpressionFactoryImpl.coerceToType(ExpressionFactoryImpl.java:47) at javax.el.BeanELResolver.invoke(BeanELResolver.java:469) at org.apache.jasper.el.JasperELResolver.invoke(JasperELResolver.java:139) at org.apache.el.parser.AstValue.getValue(AstValue.java:173) at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:185) at org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:963) at
The issue is with calling overloaded Java methods from JSP where the intended method won't be picked.
e.g. Illustration.java
Here, the jsp code getData("validInput") can pickup the second method with class parameter. Hence, the exception Cannot convert abcCache of type class java.lang.String to class java.lang.Class
Changing the second method to below solves the issue.
The problem might occur randomly with different versions of JDK/Maven/Tomcat.
As a practice, one can think of having methods with different names, if to be used in such cases.