项目启动时出现Exception in thread "HouseKeeper" java.lang.NullPointerException

解决方案:

首先建立一个servlet类:

package cn.ydc.framework.util;

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;
/*
 * 此类用来处理 在class类进行修改的时候 保存了之后服务自动重新启动 报:
 *  Exception in thread "HouseKeeper" java.lang.NullPointerException
 *  错误原因为:
 *  This is because Proxool is not being shutdown properly. 
 *  If the JVM stops then Proxool recognises that and shuts down gracefully, 
 *  but if you redeploy Proxool into some environments (for example, a servlet container) 
 *  then Proxool needs to be explicitly told so by calling ProxoolFacade.shutdown(). 
 *  If you have a servlet container then you could put it in the servlet‘s destroy() method. 
 *  Alternatively, use the ServletConfigurator to both configure and shutdown Proxool 
 */

public class HouseKeeperServlet extends HttpServlet  {
  
 /**
  * 
  */
 private static final long serialVersionUID = 4829418704873725291L;

public void destroy() {
  //此处添加处理 
  ProxoolFacade.shutdown();
 }

public void doPost(HttpServletRequest request, HttpServletResponse response)
   throws ServletException, IOException {
  doGet(request, response);
 }

public void doGet(HttpServletRequest request, HttpServletResponse response)
   throws ServletException, IOException {

}

}

web.xml  中加入:

<!-- for resolving HouseKeeper bug-->
  <servlet> 
    <servlet-name>loadServlet</servlet-name> 
    <servlet-class>cn.ydc.framework.util.HouseKeeperServlet</servlet-class> 
    <load-on-startup>1</load-on-startup> 
  </servlet>

时间: 2024-10-06 13:43:38

项目启动时出现Exception in thread "HouseKeeper" java.lang.NullPointerException的相关文章

web 环境项目(intellj部署的tomcat) 重启时报 Exception in thread &quot;HouseKeeper&quot; java.lang.NullPointerException (转)

Exception in thread "HouseKeeper" java.lang.NullPointerException at org.logicalcobwebs.proxool.HouseKeeperController.getHouseKeeperToRun(HouseKeeperController.java:52) at org.logicalcobwebs.proxool.HouseKeeperThread.run(HouseKeeperThread.java:33

Exception in thread &quot;main&quot; java.lang.NullPointerException

1.在window操作系统上,使用eclipse开发工具从hdfs分布式文件系统上下载文件报空指针异常解决方法: log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.a

MyEclipse8.5集成Tomcat7时的启动错误:Exception in thread “main” java.lang.NoClassDefFoundError org/apache/commons/logging/LogFactory

今天,安装Tomcat7.0.21后,单独用D:\apache-tomcat-7.0.21\bin\startup.bat启动web服务正常.但在MyEclipse8.5中集成配置Tomcat7后,在MyEclipse启动Tomcat服务则出现如下错误提示: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactoryat org.apache.catalina.star

Spring Boot 启动报错 Exception in thread &quot;main&quot; java.lang.StringIndexOutOfBoundsException: String index out of range: 37

使用命令 java -jar springBoot.jar  启动项目,结果报错如下: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 37 at java.lang.String.substring(String.java:1963) at org.springframework.boot.loader.jar.JarFile.create

【原】MyEclipse8.5集成Tomcat7时启动错误:Exception in thread “main” java.lang.NoClassDefFoundError

解决方法: MyEclipse->Window->Preferences->MyEclipse->Servers->Tomcat->Tomcat 6.x->Laucch->Create Launch Configuration->Classpath->Bootstrap Entities->Add External JARs->选择并填加tomcat的安装路径,比如:D:\Java\tomcat\bin\tomcat-juli.jar

NDK: ant 错误 [javah] Exception in thread &quot;main&quot; java.lang.NullPointerException 多种解决办法

1.错误提示内容 2.ant脚本对应的内容 1 <?xml version="1.0" encoding="UTF-8"?> 2 <!-- ====================================================================== 3 2016-8-28 下午3:26:45 4 5 HellNDK 6 description 7 8 cjy 9 ===========================

Exception in thread &quot;main&quot; java.lang.NullPointerException at Class.main

出现这种问题,可能的原因之一可能是对象数组未初始化. Class[] class = new Class[N]; for(int i = 0; i < N; i++){ class[i] = new Class(); } 原文地址:https://www.cnblogs.com/tenghaoxiang/p/10084359.html

Linux运行Java出现“Exception in thread &quot;main&quot; java.lang.OutOfMemoryError: Java heap space”报错

在运行如下程序时出现“Exception in thread "main" java.lang.OutOfMemoryError: Java heap space”报错: java -jar picard.jar SortVcf I=hg19.sites.vcf O=hg19.sites.sorted.vcf SEQUENCE_DICTIONARY=hg19.dict 出现这种报错说明内存不足.因此我们可以加上“-Xmx”参数 java -Xmx60g -jar picard.jar

structs2中,启动Tomcat时异常:严重: Exception starting filter struts2 java.lang.NullPointerException

structs2中,已搭建好structs2开发环境,程序无任何问题.但是,部署好项目之后,启动Tomcat时Console报错抛出异常: 严重: Exception starting filter struts2 java.lang.NullPointerException 如下图所示: 出现这个错误的原因是:这是struts-2.1.6版本的一个BUG,配置文件中设置了开发者模式,即structs.xml中包含了<constant name="struts.devMode"