`
xly1981
  • 浏览: 142724 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

maven tomcat:run指定tomcat7:

 
阅读更多

配置好下面的内容后,执行 run as -> tomcat7:run 或者tomcat6:run可以将maven的web应用在tomcat6/7里面运行 ,eclipse Indigo 版本默认tomcat:run是用tomcat6。

 DelegatingFilterProxy cannot be cast to Filter

 

请在

settings.xml

 

<pluginGroups>
<pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>

 

 

pom.xml

 

<repositories>
    <repository>
      <id>people.apache.snapshots</id>
      <url>http://repository.apache.org/content/groups/snapshots-group/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>apache.snapshots</id>
      <name>Apache Snapshots</name>
      <url>http://repository.apache.org/content/groups/snapshots-group/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

<plugins>
    <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat6-maven-plugin</artifactId>
      <version>2.0-SNAPSHOT</version>
      <configuration>

        <path>/</path>
      </configuration>
    </plugin>
    <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.0-SNAPSHOT</version>
      <configuration>
        <path>/</path>
      </configuration>
    </plugin>
  </plugins

 

 过程中遇到了一个情况,就是打成war包放到webapps下面运行时正常的,但是用tomcat:run会报错:org.springframework.web.filter.DelegatingFilterProxy cannot be cast to javax.servlet.Filter;

检查一下:

pom.xml文件编辑器(一般要装插件才能看到)下面的dependency hierarchy 里面,在右边框图里面找到servlet-api.jar,选中后在左边,右键->exclude maven artifact,去除依赖关系。

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics