、私はEclipseを使用していcf
のjava.lang.NullPointerException日PetStoreをCatalogFacadeは、Sun Java PetStoreをデモindex.jspファイルで
CatalogFacade cf = (CatalogFacade)getServletContext().getAttribute("CatalogFacade");
List<Tag> tags=cf.getTagsInChunk(0, 12); <--- cf is Null
にNULLポインタ例外を取得していますし、私は知りませんなぜCatalogFacadeがnullか、これをデバッグする方法。
何か手がかりが大変ありがとうございます。
編集:implements ServletContextListener
public void contextInitialized(ServletContextEvent sce) {
ServletContext context = sce.getServletContext();
context.setAttribute("CatalogFacade", this);
}
あなたの 'ServletContext'は属性" CatalogFacade "を持っていますか? – birryree
web.xmlにエントリがあるかどうかを確認する場合は、noを入力します。 – jeff