I have developed a Java Spring boot application as per the SAP documentation.I created the Basic stub from spring.io and then developed on top of it. This app is basically an API war file which connects to HANA database. I could succesfully test the db connection locally, able to play with CRUD in Hana database, and test the APIs locally. The moment i deploy this APP to SAP BTP, i am able to see the app is launched successfully, but i am unable to hit the APIs. I have been referring many documentations and posts in the community, but still i am failing.
Here is the manifest.yml,
applications:
- name: paymentservice
SPRING_PROFILES_ACTIVE: cloud
USE_JCO: true
instances: 1
path: target/paymentservice.war
memory: 1024M
buildpacks:
- sap_java_buildpack_jakarta
env:
JBP_CONFIG_OPEN_JDK_JRE: "{ jre: { version: 17.+ }}"
JBP_CONFIG_COMPONENTS: "jres: ['com.sap.xs.java.buildpack.jdk.SAPMachineJDK']"
SPRING_PROFILES_DEFAULT: cf
And the dependencies are below,
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<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>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.4.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>6.5.2.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-cloudfoundry-connector -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-cloudfoundry-connector</artifactId>
<version>2.0.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-spring-service-connector -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-spring-service-connector</artifactId>
<version>2.0.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sap.cloud.db.jdbc/ngdbc -->
<dependency>
<groupId>com.sap.cloud.db.jdbc</groupId>
<artifactId>ngdbc</artifactId>
<version>2.21.10</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/ngdbc-2.21.10.jar</systemPath>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sap/sapjco3 -->
<dependency>
<groupId>com.sap</groupId>
<artifactId>sapjco3</artifactId>
<version>3.0.9</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/lib/sapjco3.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sap.hcp.cf.logging</groupId>
<artifactId>cf-java-logging-support-logback</artifactId>
<version>3.0.1</version> <!-- Ensure this is the correct and latest compatible version -->
</dependency>
</dependencies>
Here is the application log
2024-07-06T08:08:09.035+0000 [APP/PROC/WEB/0] STDOUT 08:08:09,028 |-INFO in ch.qos.logback.classic.util.ContextInitializer@1f36bed9 – ch.qos.logback.classic.util.DefaultJoranConfigurator.configure() call lasted 120 milliseconds. ExecutionStatus=DO_NOT_INVOKE_NEXT_IF_ANY
2024-07-06T08:08:09.144+0000 [APP/PROC/WEB/0] STDOUT {“msg”:”1 Spring WebApplicationInitializers detected on classpath”,”level”:”INFO”,”written_ts”:”1720253289143752540″,”logger”:”org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]”,”written_at”:”2024-07-06T08:08:09.143Z”,”thread”:”main”,”type”:”log”}
2024-07-06T08:08:09.148+0000 [APP/PROC/WEB/0] STDOUT {“msg”:”For security constraints with URL pattern [/*] only the HTTP methods [HEAD OPTIONS] are covered. All other methods are uncovered.”,”level”:”ERROR”,”written_ts”:”1720253289147643162″,”logger”:”org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]”,”written_at”:”2024-07-06T08:08:09.147Z”,”thread”:”main”,”type”:”log”}
2024-07-06T08:08:09.253+0000 [APP/PROC/WEB/0] STDOUT {“msg”:”Server startup in [2992] milliseconds”,”level”:”INFO”,”written_ts”:”1720253289252729676″,”logger”:”org.apache.catalina.startup.Catalina”,”written_at”:”2024-07-06T08:08:09.252Z”,”thread”:”main”,”type”:”log”}
2024-07-06T08:08:10.373+0000 [CELL/0] STDOUT Container became healthy
2024-07-06T08:08:10.417+0000 [API/3] STDOUT Process became ready with guid f2ff51a0-2a3e-4c9e-a03b-635712b368a8 payload: {“instance”=>”a58fbcbb-51d3-45ee-5721-e02c”, “index”=>0, “cell_id”=>”68c0cb57-68a1-4c41-ab3b-d71d231ddda7”, “ready”=>true, “version”=>”a5165a0d-3f59-4a10-b13e-e2a47a9bf5d4”}
2024-07-06T08:08:25.897+0000 [RTR/13] STDOUT paymentservice.cfapps.eu20.hana.ondemand.com – [2024-07-06T08:08:25.628808033Z] “GET / HTTP/2.0” 404 0 86 “-” “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36” “10.1.8.0:63614” “10.36.198.4:61048″ x_forwarded_for:”109.171.158.155, 10.1.8.0″ x_forwarded_proto:”https” vcap_request_id:”593b83a3-32ce-4e37-7d54-b842f467f8b6″ response_time:0.268508 gorouter_time:0.000081 app_id:”f2ff51a0-2a3e-4c9e-a03b-635712b368a8″ app_index:”0″ instance_id:”a58fbcbb-51d3-45ee-5721-e02c” failed_attempts:0 failed_attempts_time:”-” dns_time:0.000000 dial_time:0.002298 tls_time:0.007268 backend_time:0.268428 x_cf_routererror:”-” x_correlationid:”-” tenantid:”-” sap_passport:”-” x_scp_request_id:”7a82bb60-6082-434b-bf11-358f9d2cbcb6-6688FB79-1A75AAD” x_cf_app_instance:”-” x_forwarded_host:”-” x_custom_host:”-” x_ssl_client:”-” x_ssl_client_session_id:”-” x_ssl_client_verify:”-” x_ssl_client_subject_dn:”-” x_ssl_client_subject_cn:”-” x_ssl_client_issuer_dn:”-” x_ssl_client_notbefore:”-” x_ssl_client_notafter:”-” x_cf_forwarded_url:”-” traceparent:”-” true_client_ip:”-” x_request_id:”-” x_b3_traceid:”593b83a332ce4e377d54b842f467f8b6″ x_b3_spanid:”7d54b842f467f8b6″ x_b3_parentspanid:”-” b3:”593b83a332ce4e377d54b842f467f8b6-7d54b842f467f8b6″
Can someone check and tell me if i am missing anything?