Thursday, October 2, 2008

javax.faces.el.PropertyNotFoundException: Error testing property 'name' in bean of type null ?

Everything look all right, all getters and setters are there. What does this exception mean?

If you declared something like

the value binding expression is valid if you can call:
employee.getUser().getName();
getUser() returns null in this case


Checklist:
* Declare the setters and getters for name _and_ user as public (public String getName()... public void setName(String name) etc.)‏
* Check if the faces-config.xml file is being deployed. This prevents the faces servlet from setting up the beans.
* Check for a typo in the faces-config.xml, where you declare the managed beans.
* Check if your class name is really "User" and not "UserBean" or similar. Even if the accessor methods are getUser() and setUser() there will probably be a cast exception internally.

No comments: