请查看下面的JSF代码。我得到一个nullpointerexception (Exception in thread "Timer-1" |#] ) at SearchHomeRegistry.getCurrentInstance().
一定有问题。我们需要弄清楚的是什么。
==========================================
public void startSchedule() {
wpd = null;
Timer timer = new Timer();
timer.schedule (new TimerTask(){
public void run(){
refreshUser();
}
},500, 500);
}
public void refreshUser() {
System.out.println("refreshUser start :" + wupromoDetails);
if (!wupromoDetails.isEmpty()) {
wpd = SearchHomeRegistry.getCurrentInstance().latestWPD();
.........
==========================================
@ApplicationScoped
public class SearchHomeRegistry extends AbstractEntityAccessor implements
Serializable {
public static SearchHomeRegistry getCurrentInstance() {
SearchHomeRegistry result = null;
FacesContext context = FacesContext.getCurrentInstance();
Map<String, Object> appMap = context.getExternalContext()
.getApplicationMap();
result = (SearchHomeRegistry) appMap.get("searchHomeRegistry");
assert (null != result);
return result;
}
..............