Springboot actuator endpoints are not working after deploying app to pcf - spring-boot

I have a springboot app which has 3 actuators enabled as below out of which 3rd one is custom,
application.properties code snippet
management.endpoints.web.exposure.include=health,refresh,customEndpoint
the endpoints when hit from local are working correctly. For example:-
http://localhost:8081/MyAppName/system/health gives below expected details:-
but when we hit the same endpoint(with pcf app route mapped) which is my_route_url/MyAppName/system/health, after deploying the app to pcf, it gives below 404 error:-
404 Not Found: Requested route ('my_route_url') does not exist.
Tried redeploying the app to pcf but that did not help.
Tried looking for solutions in other questions posted here but they are not matching scenario.
it's working in a different pcf foundation though.

Related

Unable to access Actuator when a springboot application is running via a fat jar file on an application server

I am a little out of my league on this one as I am still getting familiar with everything Springboot. Onto my problem...
I am unable to access actuator for an application that is running in a fat jar file on an application server. All works great when I run the application locally through Eclipse as I am perfectly able to access a couple of the endpoints (health, logfile) via a browser and Postman.
However, when I attempt to access those same endpoints (via curl, a browser or Postman) using the application server's url, I get a 404. I am able to access other custom written apis within the application with no issue, just not actuator apis.
I know I am missing something very obvious, but cannot figure out what that is.
Good - http://localhost:9091/actuator/health --> from a browser or Postman
Not good - http://my-app-testserver-01:9090/actuator/health or curl localhost:9090/actuator/healthand both yield the below error. NOTE that the curl is performed on the application server.
"timestamp":"2022-06-30T20:57:12.191+00:00","status":404,"error":"Not Found","path":"/actuator/health"
What else? Oh yeah, below is a snippet from my yml file pertaining to actuator and I believe that is ok.
Any insight on this is greatly appreciated. Thank you.
management:
server:
port: 9090
endpoints:
web:
exposure:
include: "health,info,logfile" ```
This is all set now. I was setting up the application on a new server and had to have the ports opened up for me. Once that was done I was able to access the Actuator apis with no issues.

Getting 401 for Spring Boot API after login to keycloak.But its work if user didn't sign in to keycloak

I'm using Spring Boot + Keycloak + Angular for my application and keycloak-spring-boot-starter uses for the backend. But this is working perfectly on my computer and when I deploy this
Without logging to the system system works perfectly
When login to the system using angular app and make a api request getting 401 from Spring boot backend
In postman without token it gives results
In postman with the token it gives 401
But on angular side (frontend) Authentification and Authorization work perfectly. Further, I have tried to run this application in the machine(angular and Spring boot run in my local machine similar environment to production) using deployed keycloak, it also works perfectly.
Since there is no related error in the console I'm really worried about how to figure out the issue. I'm kindly requesting you to help me regarding this.
Actually, it was my mistake I have set SSL to none in Keycloak configuration but Spring Boot app I have set to external. Therefore it works on my computer and when I deploy it, it didn't work.

SpringBoot Rest API: Works as Java Application, fails when deployed on tomcat

I have a Springboot project and it has a api which I can invoke from postman.
When I run the application using Main Class I'm able to hit the endpoint and get response.
But if I deploy it on tomcat using war of project the same endpoint says 404!
What am I missing?
There can be multiple possibilities
You didn't extended your application class to SpringBootServletInitializer. In this case, spring boot application will not be deployed to tomcat. To fix this add "extends SpringBootServletInitializer" to your main application class
You are hitting wrong url. Make sure you append your aplication name to url. Example - if http://localhost:8080/data works in your local, and your application name is app, you have to hit http://{{serverip:port}}/app/data when deployed
There is something wrong in application properties like DB configured is local and not accessible from tomcat etc. To check such issues, check your tomcat log file (/{{tomcat dir}}/logs/catalina.out

Fail to deploy my spring boot application to asw beanwalk

I developed a spring boot project on Intellij, which is only backend for now. and wanna deploy it to aws.
I followed below
https://developer.okta.com/blog/2019/08/07/deploy-a-spring-boot-app-with-aws-elastic-beanstalk
Like he said ,I also get 502 error at first, then I did add server_port 5000 according to him
but I still get 502 bad gateway
http://personalprojectmanagement-env.eba-xzze9hnr.us-east-2.elasticbeanstalk.com/ is my website
anyone can help?
Thanks

Aws Spring boot application view issue with jar and rest service issue with war

I would like to host one application on AWS elastic beanstalk(java). The application has one view and one rest service. First I uploaded the jar file and tried accessing, the path to view was giving me whitelabel error on AWS but it is working fine locally. Also, am able to access the rest service with jar.
After surfing the net, I created a war and uploaded on AWS(tomcat). Now, the view is working fine but I notice the path of rest service is returning 404. Can someone suggest what should I check or do?

Resources