使用sysdeo插件启动tomcat时出现ClassCastException。我用谷歌搜索这个问题,可能是由一些重复的servlet API库引起的。但是我找不到解决方案。有人遇到过同样的问题吗?

我正在使用Eclpise Helios Service Release 1 com.sysdeo.eclipse.tomcat_3.2.1。和tomcat 6.0。我的pom.xml在下面列出。

这是例外:

Servlet /test threw load() exception
java.lang.ClassCastException: org.apache.cxf.transport.servlet.CXFServlet cannot be cast to javax.servlet.Servlet
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4659)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)


pom.xml是

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.5</version>
            <executions>
                <execution>
                    <id>add-generated-sources</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>${thrift.outdir}</source>
                        </sources>
                    </configuration>
                </execution>
                <execution>
                    <id>add-test-source</id>
                    <phase>generate-test-sources</phase>
                    <goals>
                        <goal>add-test-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>${thrift.outdir}</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sysdeo-tomcat-maven-plugin</artifactId>
            <version>1.1</version>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>thrift</groupId>
        <artifactId>thrift-java</artifactId>
        <version>0.5.0</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.1</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>0.9.26</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-bundle-jaxrs</artifactId>
        <version>2.2.10</version>
    </dependency>
</dependencies>


.tomcatplugin文件是:

<?xml version="1.0" encoding="UTF-8"?>
<tomcatProjectProperties>
    <rootDir>src/main/webapp</rootDir>
    <exportSource>false</exportSource>
    <reloadable>true</reloadable>
    <redirectLogger>true</redirectLogger>
    <updateXml>true</updateXml>
    <warLocation></warLocation>
    <extraInfo>%0A%09++%0A++++</extraInfo>
    <webPath>/test</webPath>
    <webClassPathEntries>
        <webClassPathEntry>/fusion.chm/target/classes</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/ch/qos/logback/logback-classic/0.9.26/logback-classic-0.9.26.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/ch/qos/logback/logback-core/0.9.26/logback-core-0.9.26.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.13/jaxb-impl-2.1.13.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/javax/ws/rs/jsr311-api/1.0/jsr311-api-1.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/abdera/abdera-core/1.0/abdera-core-1.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/abdera/abdera-extensions-json/1.0/abdera-extensions-json-1.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/abdera/abdera-extensions-main/1.0/abdera-extensions-main-1.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/abdera/abdera-i18n/1.0/abdera-i18n-1.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/abdera/abdera-parser/1.0/abdera-parser-1.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/cxf/cxf-bundle-jaxrs/2.2.10/cxf-bundle-jaxrs-2.2.10.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/geronimo/specs/geronimo-activation_1.1_spec/1.0.2/geronimo-activation_1.1_spec-1.0.2.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/geronimo/specs/geronimo-annotation_1.0_spec/1.1.1/geronimo-annotation_1.0_spec-1.1.1.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.6/geronimo-javamail_1.4_spec-1.6.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/geronimo/specs/geronimo-servlet_2.5_spec/1.2/geronimo-servlet_2.5_spec-1.2.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/geronimo/specs/geronimo-stax-api_1.0_spec/1.0.1/geronimo-stax-api_1.0_spec-1.0.1.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/neethi/neethi/2.0.4/neethi-2.0.4.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/ws/commons/axiom/axiom-api/1.2.7/axiom-api-1.2.7.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/ws/commons/axiom/axiom-impl/1.2.7/axiom-impl-1.2.7.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/ws/commons/schema/XmlSchema/1.4.5/XmlSchema-1.4.5.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/apache/xmlbeans/xmlbeans/2.4.0/xmlbeans-2.4.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/codehaus/jettison/jettison/1.2/jettison-1.2.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.9/wstx-asl-3.2.9.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/mortbay/jetty/jetty-util/6.1.21/jetty-util-6.1.21.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/mortbay/jetty/jetty/6.1.21/jetty-6.1.21.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/springframework/spring-beans/2.5.6/spring-beans-2.5.6.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/springframework/spring-context/2.5.6/spring-context-2.5.6.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/springframework/spring-core/2.5.6/spring-core-2.5.6.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/springframework/spring-test/2.5.6/spring-test-2.5.6.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/org/springframework/spring-web/2.5.6/spring-web-2.5.6.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/thrift/thrift-java/0.5.0/thrift-java-0.5.0.jar</webClassPathEntry>
        <webClassPathEntry>/home/lsun/.m2/repository/wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/charsets.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/ext/dnsns.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/ext/localedata.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/ext/sunjce_provider.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/ext/sunpkcs11.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/jce.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/jsse.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/resources.jar</webClassPathEntry>
        <webClassPathEntry>/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/rt.jar</webClassPathEntry>
        <webClassPathEntry>org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER</webClassPathEntry>
    </webClassPathEntries>
</tomcatProjectProperties>

最佳答案

原来是geronimo-servlet_2.5_spec-1.2.jar是问题所在。我在devloader中禁用了它,服务器启动正常。

09-12 18:24