NutzCN Logo
问答 maven+tomcat插件启动报错
发布于 2933天前 作者 qq_f94df33e 1882 次浏览 复制 上一个帖子 下一个帖子
标签:

操作步骤:
1、配置pom.xml

<plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.1</version>
          <configuration>
              <port>8888</port>
              <path>/</path>
              <uriEncoding>UTF-8</uriEncoding>
              <server>tomcat7</server>
          </configuration>
      </plugin>

2、运行mvn:install
3、运行tomcat7:run
4、报错信息如下:

java.lang.ClassCastException: org.nutz.mvc.NutFilter cannot be cast to javax.servlet.Filter

注:用jetty容器的时候不会报错

3 回复

第一次用nutz...求解答
附带web.xml配置,

  <!-- Servlet Filters ================================================ -->
    <display-name>shanghuaApp</display-name>
    <filter>
        <filter-name>nutz</filter-name>
        <filter-class>org.nutz.mvc.NutFilter</filter-class>
        <init-param>
            <param-name>modules</param-name>
            <param-value>com.shanghua.module.MainModule</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>nutz</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

servlet-api的依赖,改scope为provided

添加回复
请先登陆
回到顶部