Google App Engine上传多模块项目 - 错误配置:XML错误验证

时间:2014-12-18 11:30:13

标签: java google-app-engine

我为Google App Engine构建了一个2模块应用程序,可以在开发服务器中正常运行。但是当我尝试上传它时,我收到了这个错误:

Bad configuration: XML error validating /Users/mosofsky/Developer/AudienceMarketing/audiencemarketing-ear/target/audiencemarketing-ear-1.0/audiencemarketing-frontend-1.0.war/WEB-INF/appengine-web.xml against /Users/mosofsky/.m2/repository/com/google/appengine/appengine-java-sdk/1.9.15/appengine-java-sdk/appengine-java-sdk-1.9.15/docs/appengine-web.xsd
  Caused by: cvc-complex-type.2.4.a: Invalid content was found starting with element 'module'. One of '{"http://appengine.google.com/ns/1.0":source-language, "http://appengine.google.com/ns/1.0":instance-class, "http://appengine.google.com/ns/1.0":automatic-scaling, "http://appengine.google.com/ns/1.0":manual-scaling, "http://appengine.google.com/ns/1.0":basic-scaling, "http://appengine.google.com/ns/1.0":static-files, "http://appengine.google.com/ns/1.0":resource-files, "http://appengine.google.com/ns/1.0":system-properties, "http://appengine.google.com/ns/1.0":vm-settings, "http://appengine.google.com/ns/1.0":vm-health-check, "http://appengine.google.com/ns/1.0":env-variables, "http://appengine.google.com/ns/1.0":ssl-enabled, "http://appengine.google.com/ns/1.0":sessions-enabled, "http://appengine.google.com/ns/1.0":async-session-persistence, "http://appengine.google.com/ns/1.0":user-permissions, "http://appengine.google.com/ns/1.0":public-root, "http://appengine.google.com/ns/1.0":inbound-services, "http://appengine.google.com/ns/1.0":precompilation-enabled, "http://appengine.google.com/ns/1.0":admin-console, "http://appengine.google.com/ns/1.0":static-error-handlers, "http://appengine.google.com/ns/1.0":warmup-requests-enabled, "http://appengine.google.com/ns/1.0":threadsafe, "http://appengine.google.com/ns/1.0":auto-id-policy, "http://appengine.google.com/ns/1.0":code-lock, "http://appengine.google.com/ns/1.0":vm, "http://appengine.google.com/ns/1.0":pagespeed, "http://appengine.google.com/ns/1.0":class-loader-config, "http://appengine.google.com/ns/1.0":url-stream-handler, "http://appengine.google.com/ns/1.0":use-google-connector-j}' is expected.
Please see the logs [/var/folders/dp/v_lw6kqx16bf7743hs5t9phc0000gn/T/appcfg5761671119313466239.log] for further information.
MOsofsky-MacBookPro:audiencemarketing-ear mosofsky$ 

以下是我的两个appengine-web.xml文件:

appengine-web.xml for audiencemarketing-frontend

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>audience-marketing</application> 
    <version>${appengine.app.version}</version>
    <module>audiencemarketing-frontend</module>   
    <threadsafe>true</threadsafe>

    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
    </system-properties>
</appengine-web-app>

appengine-web.xml for audiencemarketing-backend:

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>audience-marketing</application>
    <version>${appengine.app.version}</version>
    <module>audiencemarketing-backend</module>
    <threadsafe>true</threadsafe>

    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
    </system-properties>

    <instance-class>B8</instance-class>
    <basic-scaling>
        <max-instances>11</max-instances>
    </basic-scaling>

</appengine-web-app>

这是我的application.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5">
  <display-name>appengine-modules-ear</display-name>
  <module>
    <web>
      <web-uri>audiencemarketing-frontend-1.0.war</web-uri>
      <context-root>/audiencemarketing-frontend</context-root>
    </web>
  </module>
  <module>
    <web>
      <web-uri>audiencemarketing-backend-1.0.war</web-uri>
      <context-root>/audiencemarketing-backend</context-root>
    </web>
  </module>
  <library-directory>lib</library-directory>
</application>

我假设首先在application.xml文件中列出audiencemarketing-frontend,它应被视为默认模块。

我做错了什么?

1 个答案:

答案 0 :(得分:1)

根据https://cloud.google.com/appengine/docs/java/modules/routing

  

默认模块

     

默认模块是通过为模块明确指定名称来定义的   “default”,或者不包括模块中的name参数   配置文件。指定无模块或无效模块的请求   路由到默认模块。您可以使用管理控制台   在适当的时候指定模块的默认版本。

因此,我想要默认的模块不应该有一个元素。

的修正是这个

appengine-web.xml for audiencemarketing-frontend

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
    <application>audience-marketing</application> 
    <version>${appengine.app.version}</version>
<!--    <module>audiencemarketing-frontend</module>   OFFENDING LINE REMOVED -->
    <threadsafe>true</threadsafe>

    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
    </system-properties>
</appengine-web-app>

这解决了问题,然后我就可以上传并运行我的应用。