While running GAE + PrimeFaces + Spring + Maven ,BookList application,
got some errors on saving book title and author in to Datastore using JDO.
like,
**Oct 25, 2011 11:10:24 AM javax.faces.event.MethodExpressionActionListener processAction
SEVERE: Received 'java.lang.NullPointerException' when invoking action listener '# {createBook.save}' for component 'j_idt11'
Oct 25, 2011 11:10:24 AM javax.faces.event.MethodExpressionActionListener processAction
SEVERE: java.lang.NullPointerException**
error with the highlighted line.Please give a solution.
public void save(ActionEvent actionEvent) {
System.out.println("in actionEvent");
**bookDAO.persist(book);** //getting values here correctly.But cannot save!
FacesMessage facesMessage = new FacesMessage(FacesMessage.SEVERITY_INFO, "Info", "Book is saved");
FacesContext.getCurrentInstance().addMessage(null, facesMessage);
book = new MyBook();
}
thanks.
That suggests that
bookDAOis probably null. That’s the first thing to check… how are you setting thebookDAOfield?