- Multiple exceptions
jetty启动服务时错误信息如下:
WARN [main] o.e.j.w.WebAppContext [WebAppContext.java:510] Failed startup of context o.e.j.w.WebAppContext@12541cc0{/,file:/E:/webapp/,STARTING}{webapp}
org.eclipse.jetty.util.MultiException: Multiple exceptions
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:842)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1345)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1338)
eclipse定位过程如下:
双击serveletHandler.java:842, 定位到源码,从代码可以初步看出报错是由于过滤器加载导致的,单步可定位到是哪个过滤器, 并通过查看异常信息,发现原因。
/* ------------------------------------------------------------ */
/** Initialize filters and load-on-startup servlets.
*/
public void initialize()
throws Exception
{
MultiException mx = new MultiException();
//start filter holders now
if (_filters != null)
{
for (FilterHolder f: _filters)
{
try
{
f.start();
f.initialize();
}
catch (Exception e)
{
mx.add(e);
}
}
}
我代码的原因是该过滤器对应的bean未定义,
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named '***Filter' is defined
此时问题,发生转换,变成分析该bean为什么是未定义?
- bean未定义分析
查找该bean定义,发现在resource包下spring对应的xml中已定义该过滤器。
为什么仍然显示未定义呢。
查看编译后的target/classes目录,发现该xml不存在。
问题又发生变化,resources下的文件,编译时为什么没有输出到编译后的目录
- resources目录下文件未编译到输出目录
通过百度 可以查到原因,就是编译
右击项目 properties->JavabuildPath->source, 定位到resources条目 查看excluded属性 ,我的问题是有过滤导致。
点击:Excluded,然后再点击:Remove,即可。