[quote]
今天应用启动后,页面点击几下就报出 Exception in thread "HouseKeeper" java.lang.NullPointerException; 多点几次会重复出现这bug, 然后在网上找到一个比较妙的解决办法:
[/quote]
web.xml配置
今天应用启动后,页面点击几下就报出 Exception in thread "HouseKeeper" java.lang.NullPointerException; 多点几次会重复出现这bug, 然后在网上找到一个比较妙的解决办法:
[/quote]
package com.spro.core.config;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.logicalcobwebs.proxool.ProxoolFacade;
public class HouseKeeperServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
public void destroy() {
//此处添加处理
ProxoolFacade.shutdown();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
web.xml配置
<!-- 处理HouseKeeper NULL异常 -->
<servlet>
<servlet-name>HouseKeeperServlet</servlet-name>
<servlet-class>com.xxx.core.config.HouseKeeperServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>