谁能帮忙解决一下,在MyEclipse+tomcat部署JFinal是启动tomcat时报JFinalFilter cannot be cast to javax.servlet.Filter

三十六脚 发布于 2014/07/19 19:50
阅读 2K+
收藏 0

【Gopher China万字分享】华为云的Go语言云原生实战经验!>>>

@JFinal

严重: Exception starting filter jfinal

java.lang.ClassCastException: com.lytang.core.JFinalFilter 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.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
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.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2014-7-19 19:38:53 org.apache.catalina.core.StandardContext start

严重: Error filterStart


web.xml配置

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="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/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter> 
        <filter-name>jfinal</filter-name> 
        <filter-class>com.lytang.core.JFinalFilter</filter-class> 
        <init-param> 
            <param-name>configClass</param-name> 
            <param-value>com.qisentech.jfinal.config.DefaultConfig</param-value> 
        </init-param> 
    </filter> 
    <filter-mapping> 
        <filter-name>jfinal</filter-name> 
        <url-pattern>/*</url-pattern> 
    </filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

使用的是tomcat6

加载中
0
三十六脚
三十六脚

已解决,是我web.xml配置错了

贴一下正确配置

<filter> 
        <filter-name>jfinal</filter-name> 
        <filter-class>com.jfinal.core.JFinalFilter</filter-class> 
        <init-param> 
            <param-name>configClass</param-name> 
            <param-value>com.lytang.core.JFinalFilter</param-value> 
        </init-param> 
    </filter> 
    <filter-mapping> 
        <filter-name>jfinal</filter-name> 
        <url-pattern>/*</url-pattern> 
    </filter-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

返回顶部
顶部