Java – error reading type of elexception
When I showed my JSP page and tried to call a defined getCurrentlocation () function in the Person type, I received an exception.
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'm new to JSP technology Maybe someone can help me!
Thank you, Benjamin
Solution
This special elexception is a wrapper exception This is usually thrown only when an exception is thrown by calling the getter method itself When an elexception is thrown, the following happens under the encapsulation:
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 learn more about the real root cause in the stack trace The full stack trace is usually only available in the server log The real root cause is the bottom exception to stack traces For example The following one is caused by NullPointerException thrown in 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 clues to determine the problem
Again, this is generally not an EL problem It's just your own code that causes this problem