0

我最近将我的 GWT + App Engine 项目设置从单模块 maven 项目更改为多模块 maven 项目:

在此处输入图像描述

我的项目使用(在父级上)构建mvn install,没有错误,只要整个项目已经编译,它运行良好。

但是,我需要<superDevMode>false</superDevMode>在 Mojo gwt-maven-plugin 的配置中执行此操作。这是我的一些 pom.xml:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>${gwt-maven-plugin.version}</version>

            <configuration>
                <strict>true</strict>
                <testTimeOut>180</testTimeOut>
                <!-- With multiple tests use GwtTestSuite.java for speed -->
                <includes>**/*GwtTest.java</includes>
                <mode>htmlunit</mode>

                <logLevel>INFO</logLevel>
                <style>PRETTY</style>

                <copyWebapp>true</copyWebapp>
                <hostedWebapp>${webappDirectory}</hostedWebapp>

                <server>com.google.appengine.tools.development.gwt.AppEngineLauncher</server>
                <appEngineVersion>${gae.version}</appEngineVersion>
                <extraJvmArgs>-Ddatastore.default_high_rep_job_policy_unapplied_job_pct=10 -Xmx2g -Dappengine.sdk.root=${mvn.gae.home}
                </extraJvmArgs>

                <!--<port>8888</port>-->
                <superDevMode>false</superDevMode>
                <!--<incremental>true</incremental>-->
                <!--<bindAddress>0.0.0.0</bindAddress>-->

                <runTarget>Project.html</runTarget>
                <modules>
                    <module>com.utilitiessavings.usavappv7.Project</module>
                </modules>

            </configuration>

            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

如果我打开 SDM,它启动时似乎没有任何错误(使用gwt:run):

[INFO] --- gwt-maven-plugin:2.8.0-rc1:run (default-cli) @ UsavAppV7 ---
[INFO] create exploded Jetty webapp in C:\Users\Drew\IntelliJ\UsavApp\app\target\UsavAppV7-1.0-SNAPSHOT
[INFO] extract appengine 1.9.40 sdk to C:\Users\Drew\IntelliJ\UsavApp\app\target\appengine-sdk
[INFO] Super Dev Mode starting up
[INFO]    workDir: C:\Users\Drew\AppData\Local\Temp\gwt-codeserver-4487617494656562585.tmp
[ERROR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[ERROR] SLF4J: Defaulting to no-operation (NOP) logger implementation
[ERROR] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO]    Loading Java files in com.utilitiessavings.usavappv7.Project.
[INFO]    Module setup completed in 16220 ms
[INFO] 
[INFO] The code server is ready at http://127.0.0.1:9876/
[ERROR] Aug 16, 2016 4:35:26 PM com.google.appengine.tools.development.SystemPropertiesManager setSystemProperties
[ERROR] INFO: Overwriting system property key 'java.util.logging.config.file', value 'C:\Users\Drew\.m2\repository\com\google\appengine\appengine-java-sdk\1.9.40\appengine-java-sdk\appengine-java-sdk-1.9.40\config\sdk\logging.properties' with value 'WEB-INF/logging.properties' from 'C:\Users\Drew\IntelliJ\UsavApp\app\target\UsavAppV7-1.0-SNAPSHOT\WEB-INF\appengine-web.xml'
[ERROR] Aug 16, 2016 4:35:26 PM com.google.apphosting.utils.jetty.JettyLogger info
[ERROR] INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
[ERROR] Aug 16, 2016 3:35:27 PM com.google.appengine.tools.development.IsolatedAppClassLoader checkWorkingDirectory
[ERROR] WARNING: Your working directory, (C:\Users\Drew\IntelliJ\UsavApp\app) is not equal to your 
[ERROR] web application root (C:\Users\Drew\IntelliJ\UsavApp\app\target\UsavAppV7-1.0-SNAPSHOT)
[ERROR] You will not be able to access files from your working directory on the production server.
[ERROR] 
[ERROR] Aug 16, 2016 3:35:27 PM com.google.apphosting.utils.jetty.JettyLogger info
[ERROR] INFO: jetty-6.1.x
[INFO] ChatServiceImpl constructed
[INFO] BlobServiceImpl constructed
[INFO] UploadPricesServlet constructed
[ERROR] Aug 16, 2016 3:35:30 PM com.google.apphosting.utils.jetty.JettyLogger info
[ERROR] INFO: Started SelectChannelConnector@0.0.0.0:8888
[ERROR] Aug 16, 2016 3:35:30 PM com.google.appengine.tools.development.AbstractModule startup
[ERROR] INFO: Module instance default is running at http://localhost:8888/
[ERROR] Aug 16, 2016 3:35:30 PM com.google.appengine.tools.development.AbstractModule startup
[ERROR] INFO: The admin console is running at http://localhost:8888/_ah/admin
[ERROR] Aug 16, 2016 4:35:30 PM com.google.appengine.tools.development.DevAppServerImpl doStart
[ERROR] INFO: Dev App Server is now running

但是当我打开 localhost:8888 时,我收到“无法从超级开发模式加载项目”错误:

在此处输入图像描述

如果我去http://localhost:9876我看到这条消息:

HTTP 错误:500

访问 / 时出现问题。原因:

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getHeader(Ljava/lang/String;)Ljava/lang/String;


编辑:请求 pom.xml 设置

我在这里用 5 个 pom.xml 文件创建了一个要点:https ://gist.github.com/slugmandrew/1d9acf86be2c7db89031dc60de9df6e2

编辑 2:让 SDM 运行取得了一些成功,但由于某种原因没有检测到文件更改,因此它永远不会重新编译。

谷歌论坛帖子:https ://groups.google.com/forum/#!topic/google-web-toolkit/dF8KhbxnlBY

4

1 回答 1

4

HttpServletResponse 的 getHeader 方法是 Servlet 3.0 API 的一部分。检查您的类路径中是否有旧版本的 Servlet API,即冲突的 GWT 版本 jar(2.6 与 2.7)、冲突的 Jetty jar 或冲突的 servlet-api jar。

于 2016-08-16T19:19:59.173 回答