问题描述
为什么我在web.xml配置了filter之后,myeclipse的tomcat就启动不了。但是删了之后就没有拦截功能了,求教大侠应该怎么弄?
解决方案
解决方案二:
myeclipse的tomcat就启动不了?是报错还是什么?如果报错就说明配置错了具体如何配置filter可以网上搜索下
解决方案三:
看看报错的信息撒应该说的很明白
解决方案四:
可能是你的过滤器配置得有问题,你看下<url-classs>路径问题,为什么会在myeclipse的tomcat就启动不了是因为程序最先找到就是你的wed.xml文件所以他要报错!
解决方案五:
你看看wed.xml你这个标签上面的name“aa”要和下面的name“aa”相一致<filter><filter-name>aa</filter-name><filter-class>类的全路径名称</filter-class></filter><filter-mapping><filter-name>aa</filter-name><url-pattern>过滤什么文件.html</url-pattern><!--也可以是.jsp--></filter-mapping>
解决方案六:
出现这种情况肯定是配置文件出问题了,可能在某一个细节方面。建议楼主写filter配置的时候不要直接拷贝代码,而是根据提示来手写。另外tomcat启动不了,后台报的是什么错误,也许能很快发现问题。
解决方案七:
我的建议跟楼上相反,写配置文件最好COPY改,我就由此陋了个字母踌躇了好久
解决方案八:
tomcat不能启动?贴出错误信息来啊
解决方案九:
错误信息贴出来,好看点!毕竟服务器启动不起来是有很多问题的!
解决方案十:
这是我的部分错误信息:2010-11-1522:12:37org.apache.catalina.core.AprLifecycleListenerinit信息:LoadedAPRbasedApacheTomcatNativelibrary1.1.20.2010-11-1522:12:37org.apache.catalina.core.AprLifecycleListenerinit信息:APRcapabilities:IPv6[true],sendfile[true],acceptfilters[false],random[true].2010-11-1522:12:37org.apache.coyote.http11.Http11AprProtocolinit信息:InitializingCoyoteHTTP/1.1onhttp-80802010-11-1522:12:37org.apache.coyote.ajp.AjpAprProtocolinit信息:InitializingCoyoteAJP/1.3onajp-80092010-11-1522:12:37org.apache.catalina.startup.Catalinaload信息:Initializationprocessedin1090ms2010-11-1522:12:37org.apache.catalina.core.StandardServicestart信息:StartingserviceCatalina2010-11-1522:12:37org.apache.catalina.core.StandardEnginestart信息:StartingServletEngine:ApacheTomcat/6.0.292010-11-1522:12:37org.apache.catalina.startup.HostConfigdeployDescriptor信息:Deployingconfigurationdescriptorhost-manager.xml2010-11-1522:12:38org.apache.catalina.startup.HostConfigdeployDescriptor信息:Deployingconfigurationdescriptormanager.xml2010-11-1522:12:38org.apache.catalina.startup.HostConfigdeployDirectory信息:Deployingwebapplicationdirectorydocs2010-11-1522:12:38org.apache.catalina.startup.HostConfigdeployDirectory信息:Deployingwebapplicationdirectoryexamples2010-11-1522:12:39org.apache.catalina.core.ApplicationContextlog信息:ContextListener:contextInitialized()2010-11-1522:12:39org.apache.catalina.core.ApplicationContextlog信息:SessionListener:contextInitialized()2010-11-1522:12:39org.apache.catalina.startup.HostConfigdeployDirectory信息:DeployingwebapplicationdirectoryROOT2010-11-1522:12:39org.apache.catalina.startup.HostConfigdeployDirectory信息:DeployingwebapplicationdirectoryStruts2Demo2010-11-1522:12:39org.apache.catalina.startup.HostConfigdeployDirectory信息:Deployingwebapplicationdirectorystrutsdemo2010-11-1522:12:40com.opensymphony.xwork2.util.logging.commons.CommonsLoggerwarn警告:CouldnotcreateJarEntryRevisionfor[jar:file:/C:/apache-tomcat-6.0.29/webapps/strutsdemo/WEB-INF/lib/struts2-core-2.2.1.jar]!java.lang.NoClassDefFoundError:org/apache/commons/io/output/NullOutputStreamatcom.opensymphony.xwork2.util.FileManager$JarEntryRevision.build(FileManager.java:307)atcom.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:145)atcom.opensymphony.xwork2.util.FileManager.loadFile(FileManager.java:105)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:898)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:154)atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:121)atcom.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:179)atcom.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)atorg.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)atorg.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)atorg.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)atorg.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)atorg.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)atorg.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)atorg.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4651)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:785)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)atorg.apache.catalina.core.StandardService.start(StandardService.java:519)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:710)atorg.apache.catalina.startup.Catalina.start(Catalina.java:581)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)Causedby:java.lang.ClassNotFoundException:org.apache.commons.io.output.NullOutputStreamatorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)atorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)atjava.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)...38more2010-11-1522:12:41com.opensymphony.xwork2.util.logging.commons.CommonsLoggerinfo信息:Parsingconfigurationfile[struts-default.xml]2010-11-1522:12:41com.opensymphony.xwork2.util.logging.commons.CommonsLoggererror严重:DispatcherinitializationfailedUnabletoloadconfiguration.-bean-jar:file:/C:/apache-tomcat-6.0.29/webapps/strutsdemo/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:48:178atcom.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)atorg.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)atorg.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)atorg.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190)atorg.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)atorg.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)atorg.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)atorg.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4001)atorg.apache.catalina.core.StandardContext.start(StandardContext.java:4651)atorg.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)atorg.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)atorg.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)atorg.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)atorg.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)atorg.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)atorg.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)atorg.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)atorg.apache.catalina.core.StandardHost.start(StandardHost.java:785)atorg.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)atorg.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)atorg.apache.catalina.core.StandardService.start(StandardService.java:519)atorg.apache.catalina.core.StandardServer.start(StandardServer.java:710)atorg.apache.catalina.startup.Catalina.start(Catalina.java:581)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)atjava.lang.reflect.Method.invoke(Method.java:597)atorg.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)atorg.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)Causedby:Unabletoloadbean:type:org.apache.struts2.dispatcher.multipart.MultiPartRequestclass:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest-bean-jar:file:/C:/apache-tomcat-6.0.29/webapps/strutsdemo/WEB-INF/lib/struts2-core-2.2.1.jar!/struts-default.xml:48:178atcom.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:232)atorg.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)at
解决方案十一:
我的Filter配置是<filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping>
解决方案十二:
建议你贴出web.xml配置文件,如果有不能公开的,关键代码可以用*星号替代以下
解决方案十三:
没事,这只是我自己练习做的。<?xmlversion="1.0"encoding="GBK"?>-<web-appversion="2.5"xmlns="http://java.sun.com/xml/ns/javaee"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">-<filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class></filter>-<filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping>-<login-config><auth-method>BASIC</auth-method></login-config></web-app>
解决方案十四:
java.lang.NoClassDefFoundError:org/apache/commons/io/output/NullOutputStream看到没,找找是不是有NullOutputStream这个类先,知道在哪个位置找不?写的很清楚了。
解决方案十五:
struts2的jar包没有导全!
解决方案:
引用14楼figo977的回复:
struts2的jar包没有导全!
应该是这个问题,filter位置最好也按Servlet加载的顺序写。实在不行,就单独测试一个web试下。
解决方案:
你的tomcat的根目录里要加javassist-3.7.ga.jar这个jar文件在struts2app里面的blank里面有
解决方案:
我刚才给你的那个结论适合解决Dispatcherinitializationfailed这个问题而你另外一个问题是包的冲突问题struts包里都会有但是不影响正常使用至少我还没有发现刚才和你说的javassist-3.7.ga.jar导入后重启下tomcat
解决方案:
直接把struts-blank里的jar包导到自己的lib里边需要啥了再去struts的lib里找我就不信他还犯错前两天就因为缺少jar包郁闷的要命。。。