无法在App Engine标准环境上构建“适用于Java的Bookshelf应用".谷歌的例子,与pom.xml问题? [英] Unable to build "Bookshelf app for Java on App Engine standard environment" example from google, issue with pom.xml?

查看:42
本文介绍了无法在App Engine标准环境上构建“适用于Java的Bookshelf应用".谷歌的例子,与pom.xml问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在APP引擎上获取Java的书架应用" https://cloud.google.com/java/getting-started-appengine-standard/tutorial-app "

I am trying to get the bookshelf app for Java on APP engine "https://cloud.google.com/java/getting-started-appengine-standard/tutorial-app"

我已经执行了所有步骤,例如为我的项目设置结算,启用API和下载SDK.

I have performed all the steps like setting up billing for my project, enabling APIs and downloading the SDK.

我已经克隆了仓库,即.

I have cloned the repo i.e.

git clone https://github.com/GoogleCloudPlatform/getting-started-java.git

git clone https://github.com/GoogleCloudPlatform/getting-started-java.git

然后我继续跑步

mvn -Plocal clean appengine:devserver

从目录

getting-started-java/bookshelf-standard/2-structured-data

这是事情变得奇怪的地方.在pom.xml中,当我将appengine maven插件和appengine-api-1.0-sdk版本设置为1.9.73时,这是最新版本

This is where things get weird. In pom.xml when i set the appengine maven plugin and appengine-api-1.0-sdk version to 1.9.73 which is the latest version

我收到错误

打开zip文件或JAR清单丢失时出错:/home/anirudh/.m2/repository/com/google/appengine/appengine-java-sdk/1.9.73/appengine-java-sdk/appengine-java-sdk-1.9.73/lib/agent/appengine-agent.罐子

Error opening zip file or JAR manifest missing : /home/anirudh/.m2/repository/com/google/appengine/appengine-java-sdk/1.9.73/appengine-java-sdk/appengine-java-sdk-1.9.73/lib/agent/appengine-agent.jar

现在我尝试使用较旧版本的maven插件和appengine-api-1.0-sdk

Now i tried using an older version maven plugin and appengine-api-1.0-sdk namely

我无法创建DevAppserver

i get unable to create a DevAppserver

[INFO] java.lang.RuntimeException:无法创建DevAppServer[INFO]位于com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:401)[INFO]位于com.google.appengine.tools.development.DevAppServerFactory.access $ 000(DevAppServerFactory.java:31)[INFO]位于com.google.appengine.tools.development.DevAppServerFactory $ 1.run(DevAppServerFactory.java:318)[INFO]位于com.google.appengine.tools.development.DevAppServerFactory $ 1.run(DevAppServerFactory.java:315)[INFO]位于java.base/java.security.AccessController.doPrivileged(本机方法)[INFO]位于com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:314)[INFO]位于com.google.appengine.tools.development.DevAppServerMain $ StartAction.apply(DevAppServerMain.java:384)[INFO]位于com.google.appengine.tools.util.Parser $ ParseResult.applyArgs(Parser.java:45)[INFO]位于com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:257)[INFO]位于com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)[INFO]原因:java.lang.ClassCastException:ClassLoader是jdk.internal.loader.ClassLoaders$AppClassLoader@4459eb14,而不是URLClassLoader.[INFO]位于com.google.apphosting.utils.security.SecurityManagerInstaller.generatePolicyFile(SecurityManagerInstaller.java:139)[INFO]位于com.google.apphosting.utils.security.SecurityManagerInstaller.install(SecurityManagerInstaller.java:94)[INFO]位于com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:377)

[INFO] java.lang.RuntimeException: Unable to create a DevAppServer [INFO] at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:401) [INFO] at com.google.appengine.tools.development.DevAppServerFactory.access$000(DevAppServerFactory.java:31) [INFO] at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:318) [INFO] at com.google.appengine.tools.development.DevAppServerFactory$1.run(DevAppServerFactory.java:315) [INFO] at java.base/java.security.AccessController.doPrivileged(Native Method) [INFO] at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:314) [INFO] at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:384) [INFO] at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45) [INFO] at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:257) [INFO] at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248) [INFO] Caused by: java.lang.ClassCastException: ClassLoader is jdk.internal.loader.ClassLoaders$AppClassLoader@4459eb14, not a URLClassLoader. [INFO] at com.google.apphosting.utils.security.SecurityManagerInstaller.generatePolicyFile(SecurityManagerInstaller.java:139) [INFO] at com.google.apphosting.utils.security.SecurityManagerInstaller.install(SecurityManagerInstaller.java:94) [INFO] at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:377)

请找到我的pom文件

<?xml version="1.0" encoding="UTF-8"?>
<!--
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>                               <!-- REQUIRED -->

  <modelVersion>4.0.0</modelVersion>    <!-- REQUIRED -->
  <packaging>war</packaging>            <!-- REQUIRED -->

  <groupId>com.example.standard.gettingstarted</groupId>
  <artifactId>bookshelf-standard-2</artifactId>    <!-- Name of your project -->
  <version>1.0-SNAPSHOT</version>       <!-- xx.xx.xx -SNAPSHOT means development -->

  <parent> <!-- Only used for testing - NOT REQUIRED -->
    <groupId>com.example.standard.gettingstarted</groupId>
    <artifactId>bookshelf-parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../</relativePath>
  </parent>

  <properties>
    <!-- [START config] -->
    <bookshelf.storageType>datastore</bookshelf.storageType>   <!-- datastore or cloudsql -->

    <sql.dbName>bookshelf</sql.dbName>                        <!-- A reasonable default -->
<!-- Instance Connection Name - project:region:dbName -->
<!-- -Dsql.instanceName=localhost to use a local MySQL server -->
    <sql.instanceName>DATABASE-connectionName-HERE</sql.instanceName> <!-- See `gcloud sql instances describe [instanceName]` -->
    <sql.userName>root</sql.userName>                         <!-- A reasonable default -->
    <sql.password>MYSQL-ROOT-PASSWORD-HERE</sql.password> <!-- -Dsql.password=myRootPassword1234 -->
    <!-- [END config] -->

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source> <!-- REQUIRED -->
    <maven.compiler.target>1.8</maven.compiler.target> <!-- REQUIRED -->
    <maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
    <maven.compiler.showWarnings>true</maven.compiler.showWarnings>
    <maven.compiler.failOnWarning>true</maven.compiler.failOnWarning>
    <maven.war.filteringDeploymentDescriptors>true</maven.war.filteringDeploymentDescriptors>
    <appengine-maven.version>1.9.10</appengine-maven.version>
  </properties>

  <!-- THINGS ONLY USED WHEN RUN LOCALLY -->
  <profiles>
    <profile>
      <id>local</id>
      <dependencies>
        <dependency>
          <groupId>com.google.cloud.sql</groupId>
          <artifactId>mysql-socket-factory</artifactId>
          <version>1.0.2</version>
        </dependency>
        <dependency>                        <!-- http://dev.mysql.com/doc/connector-j/en/ -->
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>5.1.40</version>  <!-- v5.x.x is Java 7, v6.x.x is Java 8 -->
        </dependency>
        <dependency>
          <groupId>com.google.api-client</groupId>
          <artifactId>google-api-client-appengine</artifactId>
          <version>1.21.0</version>
        </dependency>
      </dependencies>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>com.google.appengine</groupId>
      <artifactId>appengine-api-1.0-sdk</artifactId>
      <version>1.9.71</version>
    </dependency>

    <dependency>                        <!-- REQUIRED -->
      <groupId>javax.servlet</groupId>  <!-- Java Servlet API -->
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>           <!-- Provided by the Jetty Servlet engine -->
    </dependency>

    <dependency>                        <!-- Java Server Pages -->
      <groupId>javax.servlet</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.0</version>
    </dependency>

    <dependency>                        <!-- JSP standard tag library -->
      <groupId>jstl</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>

    <dependency>                        <!-- Apache Taglibs -->
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>

    <dependency>                        <!-- Google Core Libraries for Java -->
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>  <!-- https://github.com/google/guava/wiki -->
        <!-- Guava v21.0 doesn't support Java7 -->
        <version>20.0</version>
        <scope>compile</scope>
    </dependency>

    <dependency>                        <!-- http://www.joda.org/joda-time/ -->
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
      <version>2.10.1</version>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-server</artifactId>
    </dependency>
    <!-- Selenium chokes without this, for some reason. -->
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
    </dependency>
    <dependency>                        <!-- Google Cloud Client Library for Java -->
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud</artifactId>
<version>0.5.1</version>
    </dependency>
  </dependencies>

  <build>
    <!-- Optional - for hot reload of the web application when using an IDE Eclipse / IDEA -->
    <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
    <plugins>

      <plugin>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
      <version>1.9.71</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration></plugin> <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
 </plugins>
  </build>
</project>

推荐答案

从堆栈跟踪中看,您似乎正在尝试使用Java 9+运行.尝试使用Java 8运行.

From the stack trace, it looks like you're trying to run with Java 9+. Try running with Java 8.

这篇关于无法在App Engine标准环境上构建“适用于Java的Bookshelf应用".谷歌的例子,与pom.xml问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆