PropertyNotFoundException: Target Unreachable ... returned null

JSF Situation

<h:inputText value="#{myBean.myEntity.myProperty}" />

Possible Error

Sep 16, 2013 5:40:11 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Faces Servlet] in context with path
[/MyContext] threw exception [javax.el.PropertyNotFoundException: Target
 Unreachable, 'myEntity' returned null] with root cause
javax.el.PropertyNotFoundException: Target Unreachable, 'myEntity' returned null

Solution

In File MyBean.java do this:

public class MyBean {
  // Explicitly create a new instance, so the property is not null:
  private MyEntityClass myEntity = new MyEntityClass();

  // This was the error's cause:
  // private MyEntityClass myEntity;
}