0
我正在過渡企業應用程序以使用Maven,並且當前在使用Maven在Tomcat上部署應用程序時遇到問題。AxisServlet通過Maven在Tomcat上部署Axis2時發生ClassCastException
我使用的M2e,Tomcat的7.0,和Axis2 1.70(快照)
我運行兩個命令:
dependency:copy-dependencies
tomcat:run -Dmaven.tomcat.port=8380
當我導航到http://localhost:8380/app/services/SimpleService?wsdl
,服務器JVM發出一個ClassCastException。
Sep 25, 2014 3:56:01 PM org.apache.catalina.startup.Embedded start
INFO: Starting tomcat server
Sep 25, 2014 3:56:01 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Sep 25, 2014 3:56:02 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\stephen\Code\Java\7\ECSApp\src\main\webapp\WEB-INF\lib\servlet-api-2.3.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Sep 25, 2014 3:56:02 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\stephen\Code\Java\7\ECSApp\src\main\webapp\WEB-INF\lib\tomcat-servlet-api-8.0.12.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Sep 25, 2014 3:56:02 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8380
Sep 25, 2014 3:56:02 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8380
Sep 25, 2014 3:56:40 PM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet AxisServlet as unavailable
Sep 25, 2014 3:56:40 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet AxisServlet
java.lang.ClassCastException: org.apache.axis2.transport.http.AxisServlet cannot be cast to javax.servlet.Servlet
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1116)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:724)
有沒有人有任何想法如何解決這個錯誤?
這裏是我的pom.xml以供參考:
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ad</groupId>
<artifactId>ecs</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>ad.ecs</groupId>
<artifactId>app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ECSApp</name>
<url>http://www.myorganization.org</url>
<properties>
<neethiReleaseVersion>2.0</neethiReleaseVersion>
<rampartReleaseVersion>1.4.1</rampartReleaseVersion>
<axiomReleaseVersion>1.2.14</axiomReleaseVersion>
<wodenReleaseVersion>1.0M8</wodenReleaseVersion>
<axis2ReleaseVersion>1.7.0-SNAPSHOT</axis2ReleaseVersion>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>${axis2ReleaseVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>${axis2ReleaseVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>${axis2ReleaseVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>${axiomReleaseVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-impl</artifactId>
<version>${axiomReleaseVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-dom</artifactId>
<version>${axiomReleaseVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.woden</groupId>
<artifactId>woden-api</artifactId>
<version>${wodenReleaseVersion}</version>
<exclusions>
<exclusion>
<artifactId>xercesImpl</artifactId>
<groupId>xerces</groupId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.woden</groupId>
<artifactId>woden-impl-dom</artifactId>
<version>${wodenReleaseVersion}</version>
<exclusions>
<exclusion>
<artifactId>xercesImpl</artifactId>
<groupId>xerces</groupId>
</exclusion>
<exclusion>
<artifactId>xml-apis</artifactId>
<groupId>xml-apis</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>backport-util-concurrent</groupId>
<artifactId>backport-util-concurrent</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>annogen</groupId>
<artifactId>annogen</artifactId>
<version>0.1.0</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.neethi</groupId>
<artifactId>neethi</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>ad.ecs.db</groupId>
<artifactId>legacy</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ad.ecs</groupId>
<artifactId>asyncservice</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ad.ecs</groupId>
<artifactId>alarmservice</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>axis2m</id>
<name>Axis2m Repository</name>
<url>http://axis2m.sourceforge.net/repo/</url>
</repository>
<repository>
<id>apache-snapshots</id>
<url>http://repository.apache.org/snapshots/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>axis2m</id>
<name>Axis2m Repository</name>
<url>http://axis2m.sourceforge.net/repo/</url>
</pluginRepository>
<pluginRepository>
<id>apache-snapshots</id>
<url>http://repository.apache.org/snapshots/</url>
</pluginRepository>
</pluginRepositories>
<build>
<finalName>ECSApp</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<optimize>true</optimize>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<outputDirectory>
${project.build.directory}
</outputDirectory>
</configuration>
<executions>
<execution>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
這似乎是這種情況有重複的jar文件。我有一個糟糕的項目結構,我可能會將衝突的jar發佈到我的本地存儲庫。我不確定解決這個問題的確切步驟,但我重構了我的multimodule項目並清除了我的本地依賴項。 – stephenwebber 2014-09-30 20:29:23