Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to deploy a helloworld spring-boot app on Cloud Foundry

Getting following error while deploy a simple helloworld SpringBoot app on Cloud Foundry using cf push helloworld-api command.

Note: I am not having a manifest.yml file

Error Log:

Staging app and tracing logs...
   Downloading binary_buildpack...
   Downloading python_buildpack...
   Downloading go_buildpack...
   Downloading dotnet_core_buildpack...
   Downloading php_buildpack...
   Downloaded binary_buildpack
   Downloading hwc_buildpack...
   Downloaded go_buildpack
   Downloading staticfile_buildpack...
   Downloaded dotnet_core_buildpack
   Downloading dotnet_core_buildpack_beta...
   Downloaded dotnet_core_buildpack_beta
   Downloading java_buildpack...
   Downloaded hwc_buildpack
   Downloading ruby_buildpack...
   Downloaded staticfile_buildpack
   Downloading nodejs_buildpack...
   Downloaded java_buildpack
   Downloaded python_buildpack
   Downloaded ruby_buildpack
   Downloaded nodejs_buildpack
   Downloaded php_buildpack
   Cell 501d8bad-6db9-4f37-bcbb-bf678aeaa558 creating container for instance ef6baefc-b5e2-4bb4-9c5e-1711b4b8eb5c
   Cell 501d8bad-6db9-4f37-bcbb-bf678aeaa558 successfully created container for instance ef6baefc-b5e2-4bb4-9c5e-1711b4b8eb5c
   Downloading app package...
   Downloaded app package (85.1K)
   None of the buildpacks detected a compatible application
   Exit status 222
   Cell 501d8bad-6db9-4f37-bcbb-bf678aeaa558 stopping instance ef6baefc-b5e2-4bb4-9c5e-1711b4b8eb5c
   Cell 501d8bad-6db9-4f37-bcbb-bf678aeaa558 destroying container for instance ef6baefc-b5e2-4bb4-9c5e-1711b4b8eb5c
   Cell 501d8bad-6db9-4f37-bcbb-bf678aeaa558 successfully destroyed container for instance ef6baefc-b5e2-4bb4-9c5e-1711b4b8eb5c
Error staging application: An app was not successfully detected by any available buildpack

TIP: Use 'cf buildpacks' to see a list of supported buildpacks.
FAILED

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>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

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

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

HelloWorldApplication.java

@SpringBootApplication
@RestController
public class HelloworldApplication {

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

    @RequestMapping(path = "/", method = RequestMethod.GET)
    public String greet() {
        return "Hello World !";
    }

}
like image 765
Nital Avatar asked Dec 24 '22 08:12

Nital


1 Answers

The output from staging is indicating that all of the detect scripts ran for all of the installed buildpack, including the Java buildpack, but did not detect that any were able to run your app.

The problem is with your push command, cf push helloworld-api. Since you're deploying a Java app, you need to specify -p path/to/my.jar. You need this so that your compiled application is deployed, not the source code. Without a path, cf push defaults to pushing the current directory which is probably our source code. The Java buildpack only knows how to deploy compiled apps, it cannot build and deploy your source code.

like image 90
Daniel Mikusa Avatar answered Jan 12 '23 00:01

Daniel Mikusa