I'm trying to cf push
my spring boot app to Pivot Cloud Foundry, but the container fails to start. 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. I also removed the h2 dependency because I don't want to use h2 in PCF and rebuilded the artifact before cf push
. When I run the JAR file, it opens my browser with the h2 webinterface (I don't want that).
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..
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>
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. 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. Also, the answer from @Daniel in respond to the issue might be helpful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.