java.lang.IllegalStateException: ServletConfig has not been initialized_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > java.lang.IllegalStateException: ServletConfig has not been initialized

java.lang.IllegalStateException: ServletConfig has not been initialized

 2014/8/6 15:38:09  alleni123  程序员俱乐部  我要评论(0)
  • 摘要:java.lang.IllegalStateException:ServletConfighasnotbeeninitializedatjavax.servlet.GenericServlet.getServletContext(GenericServlet.java:197)atnet.wecash.crawler.controller.StartServlet.init(StartServlet.java:20)这里的代码@Overridepublicvoidinit
  • 标签:has not Java Servlet
java.lang.IllegalStateException: ServletConfig has not been initialized
at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:197)
at net.wecash.crawler.controller.StartServlet.init(StartServlet.java:20)



这里的代码
class="java">	@Override
	public void init(ServletConfig config) throws ServletException
	{
		super.init(config);
		factory=CrawlerUtils.getCrawlerFactory();
		
		this.getServletContext().setAttribute("factory", factory);
		System.out.println("init");
		
	}

之前没有super.inti(config)导致了这个错误
发表评论
用户名: 匿名