0% found this document useful (0 votes)
75 views2 pages

Step 3 With SAP Cloud SDK - HelloWorld On SCP CloudFoundry-CODE

The document provides instructions for deploying a Java application to Cloud Foundry. It includes steps to log in to the CF API endpoint, generate a Maven archetype for a sample app, implement a simple servlet, build and package the app, define an app manifest, and push and run the app locally using Maven and TomEE.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views2 pages

Step 3 With SAP Cloud SDK - HelloWorld On SCP CloudFoundry-CODE

The document provides instructions for deploying a Java application to Cloud Foundry. It includes steps to log in to the CF API endpoint, generate a Maven archetype for a sample app, implement a simple servlet, build and package the app, define an app manifest, and push and run the app locally using Maven and TomEE.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

cf api https://api.cf.eu10.hana.ondemand.

com
cf login

mvn archetype:generate -DarchetypeGroupId=com.sap.cloud.s4hana.archetypes -


DarchetypeArtifactId=scp-cf-tomee -DarchetypeVersion=RELEASE

package com.sap.cloud.sdk.tutorial;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/hello")
public class HelloWorldServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
private static final Logger logger =
LoggerFactory.getLogger(HelloWorldServlet.class);

@Override
protected void doGet( final HttpServletRequest request, final
HttpServletResponse response )
throws ServletException, IOException
{
logger.info("I am running!");
response.getWriter().write("Hello World!");
}
}

cd /path/to/firstapp
mvn clean package

---
applications:
- name: firstapp
memory: 1024M
host: firstapp-D123456
# random-route: true # used instead of "host"
path: application/target/firstapp-application.war
buildpack: sap_java_buildpack
env:
TARGET_RUNTIME: tomee
JBP_CONFIG_SAPJVM_MEMORY_SIZES: "metaspace:96m.."

cf push

cd application
mvn tomee:run

You might also like