类的对象' com.google.gwt.dev.shell.jetty.JettyLauncher.WebAppContextWithReload'不属于' org.eclipse.jetty.webapp.WebAppContext'

时间:2016-11-22 09:18:36

标签: java maven gwt intellij-idea jetty

当我试图在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: Gwt 2.8-rc1 super dev mode is not working on IntelliJ IDEA 2016.2.5

运行配置VM选项:

-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依赖:tree。没有额外的码头版本

GWT安装目录的路径:

C:\用户\ xxx.m2 \库\ COM \谷歌\ GWT \ GWT-dev的\ 2.8.0

JDK版本:8

1 个答案:

答案 0 :(得分:0)

当我将IntelliJ IDEA从2016.2.5更新到2016.3时,问题就消失了