Reading an ELException error ... by type

I get an exception when displaying my jsp page, which is trying to call the specific getCurrentlocation() function on the Person type. The function is called ${person.currentlocation} in the jsp file.

 type Exception report message javax.el.ELException: Error reading 'currentlocation' on type **.person.Person description The server encountered an internal error that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: javax.el.ELException: Error reading 'currentlocation' on type **.person.Person 

I am new to jsp technology. Maybe someone can help me!

Thanks Benjamin

+8
java jsp el
source share
1 answer

This particular ELException is a shell exception. This is usually done only when the getter method is called, which throws an exception. Something like the following happens under the covers when this ELException was thrown:

 Object bean; String property; Method getter; // ... try { getter.invoke(bean); } catch (Exception e) { String message = String.format("Error reading '%s' on type %s", property, bean.getClass().getName()); throw new ELException(message, e); } 

You should look further into stacktrace for a real underlying reason. Full stacktrace is usually only available in server logs. The real root cause is the lowest stacktrace exception. For example. the bottom one is caused by a NullPointerException thrown into the getter method.

 javax.el.ELException: Error reading 'currentlocation' on type **.person.Person at ... at ... at ... Caused by: java.lang.NullPointerException at **.person.Person.getCurrentlocation(Person.java:42) at ... at ... 

Information about the real root cause (exception type and line number) should give you enough information to solve the problem.

Again, this is not a problem with EL in general. This is just your own code that caused the problem.

+17
source share

All Articles