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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -