class 'com.google.gwt.dev.shell.jetty.JettyLauncher.WebAppContextWithReload' 的对象不是 'org.eclipse.jetty.webapp.WebAppContext' 类型
Object of class 'com.google.gwt.dev.shell.jetty.JettyLauncher.WebAppContextWithReload' is not of type 'org.eclipse.jetty.webapp.WebAppContext'
当我尝试在 Intellij 的 SuperDevMode 中启动我的 GWT 项目时,出现以下错误:
2016-11-22 09:32:25,752 [main] INFO org.eclipse.jetty.server.Server - jetty-9.2.14.v20151106
Starting Jetty on port 8888
[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload@6e96259d{/,file:/C:/Users/xxx/.IntelliJIdea2016.2/system/gwt/xxxTrunk.1eba6fcd/xxx.b010468/run/www/,STARTING}{C:\Users\xxx\.IntelliJIdea2016.2\system\gwt\xxxTrunk.1eba6fcd\xxx.b010468\run\www}
java.lang.IllegalArgumentException: Object of class 'com.google.gwt.dev.shell.jetty.JettyLauncher.WebAppContextWithReload' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders. in file:/C:/Users/xxx/.IntelliJIdea2016.2/system/gwt/xxxTrunk.1eba6fcd/xxx.b010468/run/www/WEB-INF/jetty-web.xml
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:296)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:248)
at org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:102)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:479)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1337)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
Maven 配置:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.8.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.8.0</version>
<scope>provided</scope>
</dependency>
...
<!-- Additional GWT libraries -->
<dependency>
<groupId>net.customware.gwt.dispatch</groupId>
<artifactId>gwt-dispatch</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.mvp4g</groupId>
<artifactId>mvp4g</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>6.0p</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-gwt</artifactId>
<version>19.0</version>
</dependency>
...
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.8.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>i18n</goal>
</goals>
</execution>
</executions>
<configuration>
<extraJvmArgs>-Xmx1024m -Xms512m -Xss512k</extraJvmArgs>
<runTarget>xxx.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>xxx.Messages</i18nMessagesBundle>
<style>OBF</style>
<disableCastChecking>true</disableCastChecking>
</configuration>
</plugin>
我按照以下建议添加了 gwt-dev:
运行 配置虚拟机选项:
-Xmx2048m -XX:MaxPermSize=1024m -Djava.naming.factory.initial=org.eclipse.jetty.jndi.InitialContextFactory
jetty-web.xml配置:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
<New id="configurationDataSource" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/configurationDataSource</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">oracle.jdbc.OracleDriver</Set>
<Set name="url">xxx</Set>
<Set name="username">xxx</Set>
<Set name="password">xxx/Set>
</New>
</Arg>
</New>
<New id="configuration" class="org.eclipse.jetty.plus.jndi.EnvEntry">
<Arg>configuration</Arg>
<Arg type="java.lang.String">classpath:META-INF/application-local.properties</Arg>
<Arg type="boolean">true</Arg>
</New>
</Configure>
我分析了 mvn dependency:tree。没有包含额外的码头版本
GWT 安装目录路径:
C:\Users\xxx.m2\repository\com\google\gwt\gwt-dev.8.0
JDK版本:8
当我将 IntelliJ IDEA 从 2016.2.5 更新到 2016.3 时,问题消失了
当我尝试在 Intellij 的 SuperDevMode 中启动我的 GWT 项目时,出现以下错误:
2016-11-22 09:32:25,752 [main] INFO org.eclipse.jetty.server.Server - jetty-9.2.14.v20151106
Starting Jetty on port 8888
[WARN] Failed startup of context c.g.g.d.s.j.WebAppContextWithReload@6e96259d{/,file:/C:/Users/xxx/.IntelliJIdea2016.2/system/gwt/xxxTrunk.1eba6fcd/xxx.b010468/run/www/,STARTING}{C:\Users\xxx\.IntelliJIdea2016.2\system\gwt\xxxTrunk.1eba6fcd\xxx.b010468\run\www}
java.lang.IllegalArgumentException: Object of class 'com.google.gwt.dev.shell.jetty.JettyLauncher.WebAppContextWithReload' is not of type 'org.eclipse.jetty.webapp.WebAppContext'. Object Class and type Class are from different loaders. in file:/C:/Users/xxx/.IntelliJIdea2016.2/system/gwt/xxxTrunk.1eba6fcd/xxx.b010468/run/www/WEB-INF/jetty-web.xml
at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:296)
at org.eclipse.jetty.xml.XmlConfiguration.configure(XmlConfiguration.java:248)
at org.eclipse.jetty.webapp.JettyWebXmlConfiguration.configure(JettyWebXmlConfiguration.java:102)
at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:479)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1337)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
Maven 配置:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>2.8.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.8.0</version>
<scope>provided</scope>
</dependency>
...
<!-- Additional GWT libraries -->
<dependency>
<groupId>net.customware.gwt.dispatch</groupId>
<artifactId>gwt-dispatch</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.mvp4g</groupId>
<artifactId>mvp4g</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>6.0p</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-gwt</artifactId>
<version>19.0</version>
</dependency>
...
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.8.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test</goal>
<goal>i18n</goal>
</goals>
</execution>
</executions>
<configuration>
<extraJvmArgs>-Xmx1024m -Xms512m -Xss512k</extraJvmArgs>
<runTarget>xxx.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
<i18nMessagesBundle>xxx.Messages</i18nMessagesBundle>
<style>OBF</style>
<disableCastChecking>true</disableCastChecking>
</configuration>
</plugin>
我按照以下建议添加了 gwt-dev:
运行 配置虚拟机选项:
-Xmx2048m -XX:MaxPermSize=1024m -Djava.naming.factory.initial=org.eclipse.jetty.jndi.InitialContextFactory
jetty-web.xml配置:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure id="wac" class="org.eclipse.jetty.webapp.WebAppContext">
<New id="configurationDataSource" class="org.eclipse.jetty.plus.jndi.Resource">
<Arg>jdbc/configurationDataSource</Arg>
<Arg>
<New class="org.apache.commons.dbcp.BasicDataSource">
<Set name="driverClassName">oracle.jdbc.OracleDriver</Set>
<Set name="url">xxx</Set>
<Set name="username">xxx</Set>
<Set name="password">xxx/Set>
</New>
</Arg>
</New>
<New id="configuration" class="org.eclipse.jetty.plus.jndi.EnvEntry">
<Arg>configuration</Arg>
<Arg type="java.lang.String">classpath:META-INF/application-local.properties</Arg>
<Arg type="boolean">true</Arg>
</New>
</Configure>
我分析了 mvn dependency:tree。没有包含额外的码头版本
GWT 安装目录路径:
C:\Users\xxx.m2\repository\com\google\gwt\gwt-dev.8.0
JDK版本:8
当我将 IntelliJ IDEA 从 2016.2.5 更新到 2016.3 时,问题消失了