郁闷,好好的项目在resin下跑得溜溜的,装了个tomcat5.0,搬过来部署一下居然,启动不了服务,报错:
2005-5-13 14:50:46 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2005-5-13 14:50:46 org.apache.catalina.core.StandardContext start
严重: Context startup failed due to previous errors
查来查去,把web.xml里的filter配置去掉,就正常起来了,可是我的filter咋办呢,难道tomcat对filter的支持有问题?照理不应该啊,filter也不算是新东东咯
[@more@]
google里搜索Error filterStart里有个文章说tomcat里的bug,没有实现javax.servlet.Filter的Filter会报这样的错误:
这给偶启发,看来tomcat在启动就初始化Filter实例了,可能是偶的Filter里的啥东东执行出错导致可能,看看我的Filter的init里用到一句
mServ = (ModuleService)WebUtils.getApplicationContext(config.getServletContext()).getBean("moduleService");
是最可能发生错误了,因为这里用到了spring的org.springframework.web.context.ContextLoaderServlet,如果启动这时还没有建立该servlet实例,务必导致获取失败,抛出错误。先屏蔽一下这句话,果真启动正常了,修改一下代码,将init里的这句话丢到了doFilter里面
if(mServ==null)
mServ = (ModuleService)WebUtils.getApplicationContext(filterConfig.getServletContext()).getBean("moduleService");
问题搞定:D
不过Tomcat也真是,解析web.xml的顺序上还是太僵硬了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/67736/viewspace-798316/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/67736/viewspace-798316/