java - 执行 gae 时出现问题 :run using gae maven plugin

标签 java google-app-engine maven-gae-plugin

当我运行 gae:run 时,它成功构建 jar 并启动服务器。 但看起来服务器没有完全启动,因为我无法转到请求的页面。

当我使用 IDE(不是 maven gae 插件)和由 maven gae 插件创建的 war 启动服务器时,它启动时没有问题。

这是我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>deplake</groupId>
<artifactId>deplake-core</artifactId>
<packaging>war</packaging>
<version>1.17R1-SNAPSHOT</version>

<properties>
    <gae.version>1.6.3.1</gae.version>
    <gae.runtime>1.4.0</gae.runtime>
    <gae.home>
        ${settings.localRepository}/com/google/appengine/appengine-java-sdk/${gae.version}/appengine-java-sdk-${gae.version}
    </gae.home>
    <gae.application.version>1</gae.application.version>
    <gae.port>8081</gae.port>
</properties>

<repositories>
    <repository>
        <id>twig</id>
        <url>http://mvn.twig-persist.googlecode.com/hg</url>
    </repository>
    <repository>
        <id>uk</id>
        <url>http://uk.maven.org/maven2/</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>maven-gae-plugin-repo</id>
        <name>Maven Google App Engine Repository</name>
        <url>http://maven-gae-plugin.googlecode.com/svn/repository/</url>
    </pluginRepository>
</pluginRepositories>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>net.kindleit</groupId>
            <artifactId>maven-gae-plugin</artifactId>
            <version>0.9.2</version>
            <dependencies>
                <dependency>
                    <groupId>net.kindleit</groupId>
                    <artifactId>gae-runtime</artifactId>
                    <version>${gae.runtime}</version>
                    <type>pom</type>
                </dependency>
                <dependency>
                    <groupId>com.google.appengine</groupId>
                    <artifactId>appengine-tools-sdk</artifactId>
                    <version>${gae.version}</version>
                </dependency>
                <dependency>
                    <groupId>com.google.appengine</groupId>
                    <artifactId>appengine-api-1.0-sdk</artifactId>
                    <version>${gae.version}</version>
                </dependency>
            </dependencies>
        </plugin>

        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <configuration>
                <goals>gae:debug</goals>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>com.vercer.engine.persist</groupId>
        <artifactId>twig-persist</artifactId>
        <version>1.0.4</version>
    </dependency>
    <dependency>
        <groupId>com.opensymphony</groupId>
        <artifactId>xwork</artifactId>
        <version>2.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.freemarker</groupId>
        <artifactId>freemarker</artifactId>
        <version>2.3.19</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>3.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>opensymphony</groupId>
        <artifactId>sitemesh</artifactId>
        <version>2.4.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-core</artifactId>
        <version>2.1.6</version>
    </dependency>



</dependencies>

这是我的日志:

+ Enabling strict checksum verification on all artifact downloads.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - deplake:deplake-core:war:1.17R1-SNAPSHOT
[INFO]    task-segment: [net.kindleit:maven-gae-plugin:0.9.2:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing gae:run
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\4work\mvn+gae+struts2\test\src\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Tests are skipped.
[INFO] [war:war {execution: default-war}]
[INFO] Packaging webapp
[INFO] Assembling webapp[deplake-core] in [D:\4work\mvn+gae+struts2\test\target\deplake-core-1.17R1-SNAPSHOT]
[INFO] Dependency[Dependency {groupId=com.vercer.engine.persist, artifactId=twig-persist, version=1.0.4, type=jar}] has changed (was Dependency {groupId=com.vercer.engine.persist, artifactId=twig-persist, version=1.0.4, type=jar}).
[INFO] Dependency[Dependency {groupId=com.opensymphony, artifactId=xwork, version=2.1.2, type=jar}] has changed (was Dependency {groupId=com.opensymphony, artifactId=xwork, version=2.1.2, type=jar}).
[INFO] Dependency[Dependency {groupId=org.freemarker, artifactId=freemarker, version=2.3.19, type=jar}] has changed (was Dependency {groupId=org.freemarker, artifactId=freemarker, version=2.3.19, type=jar}).
[INFO] Dependency[Dependency {groupId=org.springframework, artifactId=spring-web, version=3.1.1.RELEASE, type=jar}] has changed (was Dependency {groupId=org.springframework, artifactId=spring-web, version=3.1.1.RELEASE, type=jar}).
[INFO] Dependency[Dependency {groupId=opensymphony, artifactId=sitemesh, version=2.4.2, type=jar}] has changed (was Dependency {groupId=opensymphony, artifactId=sitemesh, version=2.4.2, type=jar}).
[INFO] Dependency[Dependency {groupId=org.apache.struts, artifactId=struts2-core, version=2.1.6, type=jar}] has changed (was Dependency {groupId=org.apache.struts, artifactId=struts2-core, version=2.1.6, type=jar}).
[INFO] Processing war project
[INFO] Copying webapp resources[D:\4work\mvn+gae+struts2\test\src\main\webapp]
[INFO] Webapp assembled in[417 msecs]
[INFO] Building war: D:\4work\mvn+gae+struts2\test\target\deplake-core-1.17R1-SNAPSHOT.war
[INFO] [gae:run {execution: default-cli}]
16.03.2012 10:10:31 com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
16.03.2012 10:10:31 com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed D:\4work\mvn+gae+struts2\test\target\deplake-core-1.17R1-SNAPSHOT\WEB-INF/appengine-web.xml
16.03.2012 10:10:31 com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed D:\4work\mvn+gae+struts2\test\target\deplake-core-1.17R1-SNAPSHOT\WEB-INF/web.xml
16.03.2012 10:10:32 com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
16.03.2012 10:10:33 com.google.appengine.tools.development.ApiProxyLocalImpl log
INFO: javax.servlet.ServletContext log: Initializing Spring root WebApplicationContext
16.03.2012 10:10:33 org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
16.03.2012 10:10:33 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Fri Mar 16 10:10:33 UTC 2012]; root of context hierarchy
16.03.2012 10:10:33 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
16.03.2012 10:10:33 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@323274: defining beans []; root of factory hierarchy
16.03.2012 10:10:33 org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 446 ms
16.03.2012 10:10:35 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-default.xml]
16.03.2012 10:10:36 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Unable to locate configuration files of the name struts-plugin.xml, skipping
16.03.2012 10:10:36 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts-plugin.xml]
16.03.2012 10:10:36 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Parsing configuration file [struts.xml]
16.03.2012 10:10:36 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Overriding property struts.i18n.reload - old value: false new value: true
16.03.2012 10:10:36 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
INFO: Overriding property struts.configuration.xml.reload - old value: false new value: true
16.03.2012 10:10:36 com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started SelectChannelConnector@0.0.0.0:8081
16.03.2012 10:10:37 com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:8081/
16.03.2012 10:10:37 com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at http://localhost:8081/_ah/admin

当我使用 IDE 启动服务器时,日志中有更多项目。以下是启动 IDE 时添加的行:

INFO: Started SelectChannelConnector@127.0.0.1:8081
16.03.2012 10:27:54 com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:8081/
16.03.2012 10:27:54 com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at http://localhost:8081/_ah/admin
16.03.2012 10:27:56 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [struts.actionMapping]
16.03.2012 10:27:56 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [struts.valueStack]
16.03.2012 10:27:57 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [com.google.appengine.backend.BackendName]
16.03.2012 10:27:57 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [org.apache.catalina.jsp_file]
16.03.2012 10:27:57 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [org.apache.catalina.jsp_file]
16.03.2012 10:27:57 com.google.appengine.tools.appstats.AppstatsFilter doFilter
INFO: Appstats available: /appstats/details?time=1331893675205
16.03.2012 10:27:57 com.google.appengine.tools.appstats.AppstatsFilter doFilter
INFO: Appstats available: /appstats/details?time=1331893677745
16.03.2012 10:27:57 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [struts.actionMapping]
16.03.2012 10:27:57 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [struts.valueStack]
16.03.2012 10:27:57 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [com.google.appengine.backend.BackendName]
16.03.2012 10:27:57 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [org.apache.catalina.jsp_file]
16.03.2012 10:27:57 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [org.apache.catalina.jsp_file]
16.03.2012 10:28:01 com.google.appengine.tools.appstats.AppstatsFilter doFilter
INFO: Appstats available: /appstats/details?time=1331893681241
16.03.2012 10:28:01 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [struts.actionMapping]
16.03.2012 10:28:01 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [struts.valueStack]
16.03.2012 10:28:01 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [com.google.appengine.backend.BackendName]
16.03.2012 10:28:01 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [org.apache.catalina.jsp_file]
16.03.2012 10:28:01 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
WARNING: Could not find property [org.apache.catalina.jsp_file]
16.03.2012 10:28:01 com.google.appengine.tools.development.LocalResourceFileServlet doGet
WARNING: No file found for: /favicon.ico
16.03.2012 10:28:01 com.google.appengine.tools.appstats.AppstatsFilter doFilter
INFO: Appstats available: /appstats/details?time=1331893681844

最佳答案

将“mvn dependency:tree”的输出与您的项目构建路径进行比较。您可能错过了 pom.xml 中的依赖项。

关于java - 执行 gae 时出现问题 :run using gae maven plugin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9735425/

相关文章:

maven - mvn 应用引擎 :update will not deploy due to permissions error

Java - 如何迭代 json 对象键和值对?

java - 如何跨多个 Android Activity 类型共享方法

node.js - 将nodejs应用程序部署到gae/se : gcloud app deploy : This deployment has too many files

android - 使用 Android、App 引擎 + 数据存储存储个人资料图像的最佳方式

python - 在 dataStore 中创建新实体时为 "Too much contention"

java - GWT RequestFactory - 创建新对象

java - 如何将 "break"分解为需要花费太多时间才能完成该过程的方法?

google-app-engine - 使用 Google 的 Maven GAE 插件的 OAuth2 无密码 GAE 上传

google-app-engine - GAE java.lang.IllegalStateException : Must call one of set*BlobStorage() first