为什么 GWT 无法连接到多模块 maven 项目中的 superdevmode 服务器?
Why can't GWT connect to superdevmode server in multi module maven project?
我最近将我的 GWT + App Engine 项目设置从单模块 maven 项目更改为多模块 maven 项目:
我的项目使用 mvn install
(在父级上)构建,没有错误,只要编译了整个项目,就 运行 没问题。
但是,我需要在 Mojo gwt-maven-plugin 的配置中有 <superDevMode>false</superDevMode>
才能执行此操作。这是我的一些 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.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 时,我得到 "Couldn't load project from Super Dev Mode" 错误:
如果我去 http://localhost:9876 我会看到这条消息:
HTTP ERROR: 500
Problem accessing /. Reason:
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 升级到 运行,但由于某些原因未检测到文件更改,因此它永远不会重新编译。
Google 组 post:https://groups.google.com/forum/#!topic/google-web-toolkit/dF8KhbxnlBY
HttpServletResponse 的 getHeader 方法是 Servlet 3.0 的一部分API。检查您的类路径是否存在旧版本的 Servlet API,即冲突的 GWT 版本 jar(2.6 与 2.7)、冲突的 Jetty jar 或冲突的 servlet-api jar。
我最近将我的 GWT + App Engine 项目设置从单模块 maven 项目更改为多模块 maven 项目:
我的项目使用 mvn install
(在父级上)构建,没有错误,只要编译了整个项目,就 运行 没问题。
但是,我需要在 Mojo gwt-maven-plugin 的配置中有 <superDevMode>false</superDevMode>
才能执行此操作。这是我的一些 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.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 时,我得到 "Couldn't load project from Super Dev Mode" 错误:
如果我去 http://localhost:9876 我会看到这条消息:
HTTP ERROR: 500
Problem accessing /. Reason:
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 升级到 运行,但由于某些原因未检测到文件更改,因此它永远不会重新编译。
Google 组 post:https://groups.google.com/forum/#!topic/google-web-toolkit/dF8KhbxnlBY
HttpServletResponse 的 getHeader 方法是 Servlet 3.0 的一部分API。检查您的类路径是否存在旧版本的 Servlet API,即冲突的 GWT 版本 jar(2.6 与 2.7)、冲突的 Jetty jar 或冲突的 servlet-api jar。