Openshift spring boot部署失败

时间:2017-03-04 12:33:30

标签: spring-boot openshift

我正在开放式班次部署一个简单的弹簧启动应用程序 但是在建立成功后失败了。

的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.example</groupId>
    <artifactId>springdemo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

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

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.1.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>

            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- Add tomcat only if I want to run directly -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

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


</project>

AppMain

@SpringBootApplication
public class DemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}

控制器

@RestController
public class SampleController {


    @GetMapping("/test")
    public String test(){


        return "Spring Boot running......";
    }
}

当我开始从OpenShift中取出它时,所有这一切都在git上构建成功但是在得到错误并且没有部署之后。

我选择了Java和Redhut jboss(tomcat 8)

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:15.524s
[INFO] Finished at: Sat Mar 04 12:24:08 UTC 2017
/usr/bin/mvn: line 9:    33 Killed                  $M2_HOME/bin/mvn "$@"
Aborting due to error code 137 from Maven build

error: build error: non-zero (13) exit code from registry.access.redhat.com/jboss-webserver-3/webserver30-tomcat8-openshift@sha256:727603994024d133ead698832e07xxxxxxxxxxxxxxxxxxxxxxxx

1 个答案:

答案 0 :(得分:0)

检查构建yaml文件中的resources标签。 如果没有添加如下资源

resources:
limits:
  cpu: '2'
  memory: 2Gi
requests:
  cpu: '1'
  memory: 1Gi