严重:java.lang.NullPointerException GAE + PrimeFaces +春天 + Maven、图书列表应用程序

发布于 2024-12-11 23:14:42 字数 909 浏览 0 评论 0原文

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

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

祁梦 2024-12-18 23:14:42

这表明 bookDAO 可能为 null。这是要检查的第一件事...您如何设置 bookDAO 字段?

That suggests that bookDAO is probably null. That's the first thing to check... how are you setting the bookDAO field?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文