SEVERE:java.lang.NullPointerException GAE + PrimeFaces + Spring + Maven,BookList应用程序

时间:2011-10-25 12:32:28

标签: java google-app-engine primefaces

在运行GAE + PrimeFaces + Spring + Maven,BookList应用程序时,     使用JDO将书名和作者保存到Datastore时出现了一些错误。     喜欢,

**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.

1 个答案:

答案 0 :(得分:1)

这表明bookDAO可能为空。这是首先要检查的......你如何设置bookDAO字段?