无法将Java应用程序部署到App Engine

时间:2017-10-08 05:58:06

标签: java maven google-app-engine

我从github获得了示例代码的克隆,然后从这些示例中复制 cloudsql 文件夹并将其粘贴到新位置。然后我在AppEngine上部署它,它成功上传但在此之后我为云端点创建了一些新文件。然后尝试在AppEngine上部署,但这次它无法正常工作。

这是命令行消息我在Windows 7上工作。

C:\Users\Azeem\Downloads\cloud\cloudsql>mvn appengine:deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building appengine-cloudsql-j8 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> appengine-maven-plugin:1.3.1:deploy (default-cli) > package @ appengi
ne-cloudsql-j8 >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ appengine-
cloudsql-j8 ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Azeem\Downloads\cloud\clouds
ql\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ appengine-cloud
sql-j8 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ap
pengine-cloudsql-j8 ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Azeem\Downloads\cloud\clouds
ql\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ appengi
ne-cloudsql-j8 ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ appengine-cloudsql
-j8 ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:3.0.0:war (default-war) @ appengine-cloudsql-j8 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [appengine-cloudsql-j8] in [C:\Users\Azeem\Downloads\cl
oud\cloudsql\target\appengine-cloudsql-j8-1.0-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp webResources [C:\Users\Azeem\Downloads\cloud\cloudsql/src/
main/webapp/WEB-INF] to [C:\Users\Azeem\Downloads\cloud\cloudsql\target\appengin
e-cloudsql-j8-1.0-SNAPSHOT]
[INFO] Copying webapp resources [C:\Users\Azeem\Downloads\cloud\cloudsql\src\mai
n\webapp]
[INFO] Webapp assembled in [165 msecs]
[INFO] Building war: C:\Users\Azeem\Downloads\cloud\cloudsql\target\appengine-cl
oudsql-j8-1.0-SNAPSHOT.war
[INFO]
[INFO] <<< appengine-maven-plugin:1.3.1:deploy (default-cli) < package @ appengi
ne-cloudsql-j8 <<<
[INFO]
[INFO]
[INFO] --- appengine-maven-plugin:1.3.1:deploy (default-cli) @ appengine-cloudsq
l-j8 ---
[INFO] Deleting the staging directory: C:\Users\Azeem\Downloads\cloud\cloudsql\t
arget\appengine-staging
[INFO] Staging the application to: C:\Users\Azeem\Downloads\cloud\cloudsql\targe
t\appengine-staging
[INFO] Detected App Engine standard environment application.
Oct 07, 2017 10:52:07 PM com.google.cloud.tools.appengine.cloudsdk.CloudSdk logC
ommand
INFO: submitting command: C:\Program Files\Java\jdk1.8.0_144\jre\bin\java.exe -c
p C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appen
gine\google\appengine\tools\java\lib\appengine-tools-api.jar com.google.appengin
e.tools.admin.AppCfg --disable_update_check stage C:\Users\Azeem\Downloads\cloud
\cloudsql\target\appengine-cloudsql-j8-1.0-SNAPSHOT C:\Users\Azeem\Downloads\clo
ud\cloudsql\target\appengine-staging
[INFO] GCLOUD: Reading application configuration data...
[INFO] GCLOUD: Bad configuration: XML error validating <?xml version="1.0" encod
ing="utf-8"?>
[INFO] GCLOUD: <!--
[INFO] GCLOUD:   Copyright 2016 Google Inc.
[INFO] GCLOUD:   Licensed under the Apache License, Version 2.0 (the "License");

[INFO] GCLOUD:   you may not use this file except in compliance with the License
.
[INFO] GCLOUD:   You may obtain a copy of the License at
[INFO] GCLOUD:         http://www.apache.org/licenses/LICENSE-2.0
[INFO] GCLOUD:   Unless required by applicable law or agreed to in writing, soft
ware
[INFO] GCLOUD:   distributed under the License is distributed on an "AS IS" BASI
S,
[INFO] GCLOUD:   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 implied.
[INFO] GCLOUD:   See the License for the specific language governing permissions
 and
[INFO] GCLOUD:   limitations under the License.
[INFO] GCLOUD: -->
[INFO] GCLOUD: <!-- [START config] -->
[INFO] GCLOUD: <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
[INFO] GCLOUD:   <threadsafe>true</threadsafe>
[INFO] GCLOUD:   <runtime>java8</runtime>
[INFO] GCLOUD:   <use-google-connector-j>true</use-google-connector-j>
[INFO] GCLOUD:
[INFO] GCLOUD:   <service>cloudsql</service>
[INFO] GCLOUD:
[INFO] GCLOUD:   <system-properties>
[INFO] GCLOUD:     <property name="cloudsql" value="jdbc:google:mysql://analog-p
remise-181709:asia-northeast1:testinstance/testdatabase?user=root&amp;password=p
akistan312" />
[INFO] GCLOUD:     <property name="cloudsql-local" value="jdbc:mysql://google/te
stdatabase?useSSL=false&amp;cloudSqlInstance=analog-premise-181709:asia-northeas
t1:testinstance&amp;socketFactory=com.google.cloud.sql.mysql.SocketFactory&amp;u
ser=root&amp;password=pakistan312" />
[INFO] GCLOUD:   </system-properties>
[INFO] GCLOUD:
[INFO] GCLOUD:   <!-- ENDPOINTS -->
[INFO] GCLOUD:   <system-properties>
[INFO] GCLOUD:         <property name="java.util.logging.config.file" value="WEB
-INF/logging.properties"/>
[INFO] GCLOUD:     </system-properties>
[INFO] GCLOUD:
[INFO] GCLOUD:    <env-variables>
[INFO] GCLOUD:         <env-var name="ENDPOINTS_SERVICE_NAME" value="YOUR_PROJEC
T_ID.appspot.com" />
[INFO] GCLOUD:     </env-variables>
[INFO] GCLOUD:
[INFO] GCLOUD: </appengine-web-app>
[INFO] GCLOUD: <!-- [END config] -->
[INFO] GCLOUD:  against C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk
\platform\google_appengine\google\appengine\tools\java\docs\appengine-web.xsd
[INFO] GCLOUD:   Caused by: cvc-complex-type.2.4.a: Invalid content was found st
arting with element 'system-properties'. One of '{"http://appengine.google.com/n
s/1.0":application, "http://appengine.google.com/ns/1.0":version, "http://appeng
ine.google.com/ns/1.0":module, "http://appengine.google.com/ns/1.0":instance-cla
ss, "http://appengine.google.com/ns/1.0":automatic-scaling, "http://appengine.go
ogle.com/ns/1.0":manual-scaling, "http://appengine.google.com/ns/1.0":basic-scal
ing, "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":vm-settings, "
http://appengine.google.com/ns/1.0":beta-settings, "http://appengine.google.com/
ns/1.0":vm-health-check, "http://appengine.google.com/ns/1.0":health-check, "htt
p://appengine.google.com/ns/1.0":liveness-check, "http://appengine.google.com/ns
/1.0":readiness-check, "http://appengine.google.com/ns/1.0":resources, "http://a
ppengine.google.com/ns/1.0":network, "http://appengine.google.com/ns/1.0":env-va
riables, "http://appengine.google.com/ns/1.0":ssl-enabled, "http://appengine.goo
gle.com/ns/1.0":sessions-enabled, "http://appengine.google.com/ns/1.0":async-ses
sion-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-reque
sts-enabled, "http://appengine.google.com/ns/1.0":auto-id-policy, "http://appeng
ine.google.com/ns/1.0":code-lock, "http://appengine.google.com/ns/1.0":vm, "http
://appengine.google.com/ns/1.0":env, "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":api-config}' is expected.
[INFO] GCLOUD: Please see the logs [C:\Users\Azeem\AppData\Local\Temp\appcfg7263
310358647343011.log] for further information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.220 s
[INFO] Finished at: 2017-10-07T22:52:07-07:00
[INFO] Final Memory: 15M/217M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:1.3
.1:deploy (default-cli) on project appengine-cloudsql-j8: Execution default-cli
of goal com.google.cloud.tools:appengine-maven-plugin:1.3.1:deploy failed: Non z
ero exit: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException

C:\Users\Azeem\Downloads\cloud\cloudsql>

这是 pom.xml

<!--
 Copyright 2016 Google Inc.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->
<project>
  <modelVersion>4.0.0</modelVersion>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <groupId>com.example.appengine</groupId>
  <artifactId>appengine-cloudsql-j8</artifactId>

  <!--<parent>
    <artifactId>appengine-java8-samples</artifactId>
    <groupId>com.google.cloud</groupId>
    <version>1.0.0</version>
    <relativePath>..</relativePath>
  </parent>-->

<!-- [START properties] -->
  <properties>
<!-- INSTANCE_CONNECTION_NAME from Cloud Console > SQL > Instance Details > Properties
     or gcloud sql instances describe <instance>
     project:region:instance for Cloud SQL 2nd Generation or
     project:instance        for Cloud SQL 1st Generation
-->
    <INSTANCE_CONNECTION_NAME>analog-premise-181709:asia-northeast1:testinstance</INSTANCE_CONNECTION_NAME>
    <user>root</user>
    <password>pakistan312</password>
    <database>testdatabase</database>

    <!-- ENDPOINTS -->
    <endpoints.framework.version>2.0.8</endpoints.framework.version>
    <endpoints.management.version>1.0.4</endpoints.management.version>
    <endpoints.project.id>YOUR_PROJECT_ID</endpoints.project.id>
    <appengine.maven.plugin.version>1.3.1</appengine.maven.plugin.version>

    <maven.compiler.target>1.8</maven.compiler.target>
    <maven.compiler.source>1.8</maven.compiler.source>
  </properties>
<!-- [END properties] -->

  <dependencies>
    <!-- ENDPOINTS -->
    <dependency>
            <groupId>com.google.endpoints</groupId>
            <artifactId>endpoints-framework</artifactId>
            <version>${endpoints.framework.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.endpoints</groupId>
            <artifactId>endpoints-management-control-appengine-all</artifactId>
            <version>1.0.5</version>
        </dependency>

    <!-- Parent POM defines ${appengine.sdk.version} (updates frequently). -->
    <dependency>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-api-1.0-sdk</artifactId>
      <version>1.9.57</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
      <type>jar</type>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.google.api-client</groupId>
      <artifactId>google-api-client-appengine</artifactId>
      <version>1.23.0</version>
    </dependency>

    <!-- [START dependencies] -->
    <!-- Driver injected at runtime by the use of <use-google-connector-j> in appengine-web.xml -->
    <dependency> <!-- Only used locally -->
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.42</version>  <!-- v5.x.x is for production, v6.x.x EAP X DevAPI -->
    </dependency>
    <dependency>
      <groupId>com.google.cloud.sql</groupId>
      <artifactId>mysql-socket-factory</artifactId> <!-- mysql-socket-factory-connector-j-6 if using 6.x.x -->
      <version>1.0.4</version>
    </dependency>
    <!-- [END dependencies] -->
  </dependencies>
  <build>
    <!-- for hot reload of the web application -->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.0.0</version>
        <configuration>
          <webResources>
            <!-- in order to interpolate version from pom into appengine-web.xml -->
            <resource>
              <directory>${basedir}/src/main/webapp/WEB-INF</directory>
              <filtering>true</filtering>
              <targetPath>WEB-INF</targetPath>
            </resource>
          </webResources>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.google.cloud.tools</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
        <version>1.3.1</version>
        <configuration>
          <deploy.promote>true</deploy.promote>
          <deploy.stopPreviousVersion>true</deploy.stopPreviousVersion>
        </configuration>
      </plugin>

      <!-- ENDPOINTS -->
      <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>endpoints-framework-maven-plugin</artifactId>
                <version>1.0.1</version>
                <configuration>
                    <!-- plugin configuration -->
                    <hostname>${endpoints.project.id}.appspot.com</hostname>
                </configuration>
            </plugin>

    </plugins>
  </build>
</project>

你能告诉我这是什么问题吗?

1 个答案:

答案 0 :(得分:0)

看起来与appengine-web.xml文件有关。 认为可以指向您的项目ID,其中包含YOUR_PROJECT_ID:

env-var name =&#34; ENDPOINTS_SERVICE_NAME&#34;值=&#34; YOUR_PROJECT_ID.appspot.com&#34;

接下来,您将系统属性标记声明两次。移动:

property name =&#34; java.util.logging.config.file&#34;值=&#34; WEB -INF / logging.properties&#34;

到上面的那个并删除第二个,因此只声明了一个system-properties标记。

最后请确保您更改密码pakistan312,因为它在日志中可见。