Невозможно создать пример приложения "Книжная полка для Java в стандартной среде App Engine" из Google, проблема с pom.xml? - PullRequest
0 голосов
/ 03 апреля 2019

Я пытаюсь получить книжное приложение для Java на движке APP «https://cloud.google.com/java/getting-started-appengine-standard/tutorial-app"

Я выполнил все шаги, такие как настройка биллинга для моего проекта, включение API и загрузка SDK.

Я клонировал репо, т. Е.

мерзавец клон 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, которая является последней версией

Я получаю ошибку

Ошибка при открытии 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. баночка

Теперь я попытался использовать более старую версию плагина maven и appengine-api-1.0-sdk, а именно

Я не могу создать 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 is 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)

Пожалуйста, найдите мой файл 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>

1 Ответ

0 голосов
/ 13 мая 2019

Судя по трассировке стека, вы пытаетесь запустить Java 9+. Попробуйте запустить с Java 8.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...