配置Struts2.0 启动taomcat时异常

异常信息:

2007-5-16 10:47:42 org.apache.coyote.http11.Http11AprProtocol init

信息: Initializing Coyote HTTP/1.1 on http-9090

2007-5-16 10:47:42 org.apache.coyote.ajp.AjpAprProtocol init

信息: Initializing Coyote AJP/1.3 on ajp-8009

2007-5-16 10:47:42 org.apache.catalina.startup.Catalina load

信息: Initialization processed in 2164 ms

2007-5-16 10:47:43 org.apache.catalina.core.StandardService start

信息: Starting service Catalina

2007-5-16 10:47:43 org.apache.catalina.core.StandardEngine start

信息: Starting Servlet Engine: Apache Tomcat/ 5.5.23

2007-5-16 10:47:43 org.apache.catalina.core.StandardHost start

信息: XML validation disabled

log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).

log4j:WARN Please initialize the log4j system properly.

2007-5-16 10:47:50 org.apache.catalina.core.StandardContext start

严重: Error filterStart

2007-5-16 10:47:50 org.apache.catalina.core.StandardContext start

严重: Context [/BookManage] startup failed due to previous errors

2007-5-16 10:47:51 org.apache.catalina.core.ApplicationContext log

信息: ContextListener: contextInitialized()

2007-5-16 10:47:51 org.apache.catalina.core.ApplicationContext log

信息: SessionListener: contextInitialized()

2007-5-16 10:47:52 org.apache.catalina.core.ApplicationContext log

信息: ContextListener: contextInitialized()

2007-5-16 10:47:52 org.apache.catalina.core.ApplicationContext log

信息: SessionListener: contextInitialized()

2007-5-16 10:47:57 org.apache.catalina.loader.WebappClassLoader validateJarFile

信息: validateJarFile(C:\Tomcat 5.5\webapps\TopHyTree\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2 . Offending class: javax/servlet/Servlet.class

log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).

log4j:WARN Please initialize the log4j system properly.

2007-5-16 10:48:01 org.apache.coyote.http11.Http11AprProtocol start

信息: Starting Coyote HTTP/1.1 on http-9090

2007-5-16 10:48:02 org.apache.coyote.ajp.AjpAprProtocol start

信息: Starting Coyote AJP/1.3 on ajp-8009

2007-5-16 10:48:03 org.apache.catalina.storeconfig.StoreLoader load

信息: Find registry server-registry.xml at classpath resource

2007-5-16 10:48:03 org.apache.catalina.startup.Catalina start

信息: Server startup in 20835 ms

红色字体为出错信息,原来以为是用Filter(过滤器或者拦截器)出错,因为把把web.xml里的filter配置去掉,就正常起来了,在网上查找发现两种情况:

    1、运用Filte包不齐全
 2、第二种情况:

google里搜索Error filterStart里有个文章说tomcat里的bug,没有实现javax.servlet.FilterFilter会报这样的错误:

看来tomcat在启动就初始化Filter实例了,可能是Filter里的啥东东执行出错导致可能,看看Filterinit里用到一句

mServ = (ModuleService)WebUtils.getApplicationContext(config.getServletContext()).getBean("moduleService");

是最可能发生错误了,因为这里用到了springorg.springframework.web.context.ContextLoaderServlet,如果启动这时还没有建立该servlet实例,务必导致获取失败,抛出错误。先屏蔽一下这句话,果真启动正常了,修改一下代码,将init里的这句话丢到了doFilter里面

        if(mServ==null)
            mServ = (ModuleService)WebUtils.getApplicationContext(filterConfig.getServletContext()).getBean("moduleService");

不过Tomcat也真是,解析web.xml的顺序上还是太僵硬了。

我的出错情况:

经仔细推敲查找发现是配置文件struts.xml配置时候action文件名错误

原因:tomcat启动时会通过web.xml文件寻找struts.xml文件。又因struts2.0默认有拦截器的,所以如果这里的有错误信息,就会报Filter错误,很容易引起误导。



你可能感兴趣的:(配置Struts2.0 启动taomcat时异常)