执行gae时遇到麻烦:使用gae maven插件运行

时间:2012-03-16 10:17:54

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

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

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

这是我的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

1 个答案:

答案 0 :(得分:0)

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