Pivot Cloud Foundry error: "Browser detection failed and system property h2.browser not set" - Spring Boot 2

Pivot Cloud Foundry error: "Browser detection failed and system property h2.browser not set" - Spring Boot 2

我正在尝试 cf push 我的 spring 引导应用程序到 Pivot Cloud Foundry,但容器无法启动。这是错误输出:

   2018-08-21T12:48:55.34+0200 [CELL/0] OUT Starting health monitoring of container
   2018-08-21T12:48:55.81+0200 [APP/PROC/WEB/0] OUT JVM Memory Configuration: -Xmx427509K -Xss1M -XX:ReservedCodeCacheSize=240M -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=109066K
   2018-08-21T12:48:55.81+0200 [APP/PROC/WEB/0] OUT Failed to start a browser to open the URL http://10.246.203.10:8082: Browser detection failed and system property h2.browser not set
   2018-08-21T12:49:56.15+0200 [HEALTH/0] ERR Failed to make TCP connection to port 8080: connection refused
   2018-08-21T12:49:56.15+0200 [CELL/0] ERR Timed out after 1m0s: health check never passed.

我尝试将 h2.browser 属性 设置为 "opera"、falsetrue in Application.yml 但这并没有解决问题。我还删除了 h2 依赖项,因为我不想在 PCF 中使用 h2,并在 cf push 之前重建了工件。当我 运行 JAR 文件时,它会使用 h2 网络界面打开我的浏览器(我不想要那个)。

我在这里错过了什么?

编辑:我想我可能需要将参数传递给 PCF 中的 java 应用程序以禁用 H2 的控制台(浏览器部分)但不确定..

Application.yml:

  datasource:
    driverClassName: com.mysql.jdbc.Driver
    url: jdbc:mysql://my_url_here
    username: my_username_here
    password: my_password_here
  jpa:
    hibernate.ddl-auto: none
    show_sql: false

manifest.yml

---
applications:
- name: cookie-backend
  memory: 1024M
  instances: 1
  random-route: true
  buildpack: java_buildpack
  path: out/artifacts/cookie_backend_jar/cookie-backend.jar
  services:
  - mysql

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>com</groupId>
    <artifactId>cookie</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>cookie</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.github.javafaker</groupId>
            <artifactId>javafaker</artifactId>
            <version>0.15</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>

我解决了这个问题,首先开始一个新的 Spring 项目,然后在我的新项目 POM 文件中导入所有依赖项,然后按顺序添加回所有 类(代码)。我最终在相同的代码库上完成了一个新项目,没有出现错误。

这不是它出了什么问题的确切答案,但它可能对试图解决相同问题的人有所帮助。我现在在生产服务器上使用 h2。另外,@Daniel 对问题的回答可能会有所帮助。