我用Vaadin 7,和vaadin有一個默認的包javax.servlet
,我需要在我的依賴其中包含另一個javax.servlet
com.google.gwt
。當我運行我的應用程序,我得到這個錯誤:從com.google.gwt依賴排除javax.servlet包上的pom.xml
SEVERE: Allocate exception for servlet Vaadin Application Servlet
java.lang.ClassCastException: com.vaadin.server.VaadinServlet cannot be cast to javax.servlet.Servlet
現在我想從這種依賴排除的javax.servlet,這裏就是我試過到目前爲止:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.6.1</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
這:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<minimizeJar>true</minimizeJar>
<artifact>com.google.gwt:gwt-user</artifact>
<includes>
<include>com/google/**</include>
</includes>
<excludes>
<exclude>javax/servlet/**</exclude>
<exclude>javax/servlet/http/**</exclude>
<exclude>javax/servlet/resources/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
但兩者沒有工作!幫幫我!
它的工作,非常感謝!你能否在你的文章中解釋'gwt-sevlet'和'gwt-user'之間的區別? – deltascience