Exception starting filter encodingFilter

Posted stackOverFlow

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Exception starting filter encodingFilter相关的知识,希望对你有一定的参考价值。

1. maven运行tomcat6出现错误Exception starting filter encodingFilter:

严重: Exception starting filter encodingFilter
java.lang.ClassCastException: org.springframework.web.filter.CharacterEncodingFilter cannot be cast to javax.servlet.Filter
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
at org.apache.tomcat.maven.plugin.tomcat6.AbstractRunMojo.startContainer(AbstractRunMojo.java:997)
at org.apache.tomcat.maven.plugin.tomcat6.AbstractRunMojo.execute(AbstractRunMojo.java:512)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)

at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

  解决办法:

  将

<dependency>
  <groupId>javax</groupId>
  <artifactId>javaee-api</artifactId>
  <version>7.0</version>
</dependency>

  修改为

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>7.0</version>
    <scope>provided</scope>
</dependency>

Scope的含义和使用

  <dependency>中<scope>,它主要管理依赖的部署。目前<scope>可以使用5个值: 
    * compile,缺省值,适用于所有阶段,会随着项目一起发布。 
    * provided,类似compile,期望JDK、容器或使用者会提供这个依赖。如servlet.jar。 
    * runtime,只在运行时使用,如JDBC驱动,适用运行和测试阶段。 
    * test,只在测试时使用,用于编译和运行测试代码。不会随项目发布。 
    * system,类似provided,需要显式提供包含依赖的jar,Maven不会在Repository中查找它。

依赖范围(scope) 主源码classpath可用 测试源码classpath可用 会被打包
compile 缺省值 TRUE TRUE TRUE
test FALSE TRUE FALSE
runtime FALSE TRUE TRUE
provided TRUE TRUE FALSE

以上是关于Exception starting filter encodingFilter的主要内容,如果未能解决你的问题,请参考以下文章

严重: Exception starting filter struts2 Unable to load configuration

JAVA_Exception starting filter struts2怎么办

javaEE中错误提示 Exception starting filter BackServletFilter java.lang.ClassNotFoundException: tmall.filt

启动tomcat后struts框架报异常严重: Exception starting filter struts2 Unable to load configuration.

我将IDEA Maven Web项目 clone到本地导入到Eclipse中,启动服务器的时候会出现这个错误:SEVERE: Exception starting filter [hiddenHttp

Process.Start() 打开 URL 有时会抛出 Win32Exception?