简体   繁体   English

Pivot Cloud Foundry 错误:“浏览器检测失败且系统属性 h2.browser 未设置” - Spring Boot 2

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

I'm trying to cf push my spring boot app to Pivot Cloud Foundry, but the container fails to start.我正在尝试cf push我的 spring 启动应用程序cf push送到 Pivot Cloud Foundry,但容器无法启动。 This is the error output:这是错误输出:

   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.

I tried to set the h2.browser property to "opera", false and true in Application.yml but that did not solve the problem.我试图在 Application.yml 中将 h2.browser 属性设置为“opera”、 falsetrue ,但这并没有解决问题。 I also removed the h2 dependency because I don't want to use h2 in PCF and rebuilded the artifact before cf push .我还删除了 h2 依赖项,因为我不想在 PCF 中使用 h2 并在cf push之前重建工件。 When I run the JAR file, it opens my browser with the h2 webinterface (I don't want that).当我运行 JAR 文件时,它会使用 h2 网络界面打开我的浏览器(我不想要那样)。

What am I missing here?我在这里缺少什么?

EDIT: I think I might need to pass an argument to the java app in PCF to disable the console (browser part) of H2 but not sure..编辑:我想我可能需要将参数传递给 PCF 中的 Java 应用程序以禁用 H2 的控制台(浏览器部分),但不确定..

Application.yml:应用程序.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清单文件.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 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>

I solved it by first starting a new Spring project, secondly importing all the dependancies in my new project POM file and and than adding back all classes (code) in that order.我通过首先启动一个新的 Spring 项目来解决它,然后在我的新项目 POM 文件中导入所有依赖项,然后按顺序添加回所有类(代码)。 I ended up with a new project on the same codebase without the error.我最终在相同的代码库上创建了一个没有错误的新项目。

This is not the exact answer to what was going wrong with it, but it might be helpfull for someone trying to solve the same problem.这不是它出了什么问题的确切答案,但对于试图解决相同问题的人来说可能会有所帮助。 I'm using h2 now on a production server.我现在在生产服务器上使用 h2。 Also, the answer from @Daniel in respond to the issue might be helpful.此外,@Daniel 对这个问题的回答可能会有所帮助。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Cloud Foundry - Spring Boot:如何在用户浏览器中打开URL? - Cloud Foundry - Spring Boot: How to open a URL in User's Browser? Cloud Foundry Spring Boot应用程序中的连接被拒绝错误 - Connection Refused Error in Cloud Foundry Spring Boot application Pivotal Cloud Foundry(PCF)弹簧启动应用程序停止运行且没有错误 - Pivotal Cloud Foundry (PCF) spring boot application stops working without error 服务器错误 500:不存在任何值。 Spring 在 Pivotal Cloud Foundry 上的引导部署 - Server Error 500: No value present. Spring Boot deployment on Pivotal Cloud Foundry 将Spring应用程序部署到Cloud Foundry时出错 - Error when deploying Spring app to Cloud Foundry Spring Boot先失败,然后在Pivotal Cloud Foundry中自动启动 - Spring boot rashes first and then start automatically in Pivotal Cloud Foundry Cloud Foundry:如何使用额外的 JVM 命令部署 Spring Boot 应用程序 - Cloud Foundry : How to deploy spring boot app with an additional JVM command 部署和连接Cloud Foundry服务(MongoDB,Java,Spring Boot) - Deploying and Connecting cloud foundry service (MongoDB, Java, Spring Boot) 在Cloud Foundry上的Docker中启用HTTPS的情况下运行Spring Boot应用程序 - Running Spring Boot application with HTTPS enabled in docker on cloud foundry Spring Boot应用程序在云铸造厂java.lang.IllegalStateException上崩溃 - spring boot app crashing on cloud foundry java.lang.IllegalStateException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM