Action代码:Iterator serviceIt = TimerServlet.serviceL.iterator();
int serviceI = 0; //创建迭加变量
while(serviceIt.hasNext()){
Topic serviceT = (Topic) serviceIt.next(); //迭代获取话题
Path.addElement("hot").setText(serviceT.getTotitle()); //添加子节点
serviceI++; //累加迭加变量
if(serviceI == 5){ //当累加变量加5时(获取5位时)、停止迭代
break;
}
}Servlet代码: @Autowired
@Qualifier("topicServiceIMPL")
private TopicService topicService; // 调用topicService
public static List<Topic> serviceL;
public void init() throws ServletException {
   if(serviceL != null){
   serviceL.clear();
   }
       Timer timer = new Timer(); 
       timer.schedule(new TimerTask() {
public void run() {
System.out.println("存前:" + serviceL);
serviceL = topicService.findServiceTopic();
System.out.println("存后:" + serviceL);
}
       }, 0, 10000);
}Service代码: public List<Topic> findServiceTopic() {;
    return topicDaoIMPL.findServiceTopic();
}需实现功能:
  当服务器启动则进行查询数据库存值、在规定时间内取值时不进行计算取值、到规定时间时系统自动再次进行查询存值报错:Exception in thread "Timer-2" java.lang.NullPointerException
at com.gys.util.TimerServlet$1.run(TimerServlet.java:31)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
at com.gys.util.TimerServlet$1.run(TimerServlet.java:31)提示错误行:serviceL = topicService.findServiceTopic();
请教、如解决立马给分、急、在线等!!