eclipse - java.lang.NullPointerException Sun PetStore CatalogFacade -
in sun java petstore demo index.jsp file, i'm getting null pointer exception on cf
catalogfacade cf = (catalogfacade)getservletcontext().getattribute("catalogfacade"); list<tag> tags=cf.gettagsinchunk(0, 12); <--- cf null
i'm using eclipse , don't know why catalogfacade null or how debug this.
clue appreciated.
edit: in catalogfacade
class implements servletcontextlistener
public void contextinitialized(servletcontextevent sce) { servletcontext context = sce.getservletcontext(); context.setattribute("catalogfacade", this); }
my first investigation see if getservletcontext().getattribute("catalogfacade");
returns null
.
if does, you've never stored catalogfacade
object in application. perhaps @ storing using getservletcontext().setattribute("catalogfacade", cf);
?
that's can (with little info you've provided).
Comments
Post a Comment