Essentially I am pretty new to coding, so this might sound extremely stupid, but I have no errors in my application. I am trying to bring over "api/v1/user-profile" from my application to run it in my browser under localhost:8080/api/v1/user-profile, but it isn't working. What am I doing wrong exactly? My error message is "Safari can't connect to the server"
CodePudding user response:
It's hard to tell. Are you sure that your spring boot application is actually running? You can check if anything is listening to that port running netstat | grep "8080"
. If you don't get any output it means that your app is not started or not listening to port 8080
CodePudding user response:
It means your spring boot application is not running other wise you must have received white label error page if you were hitting the wrong(non-existent) API end point.
If that's not the case then please share more details for better help.
CodePudding user response:
You can try following steps to debug the issue you are facing.
First, make sure your application and tomcat instance is running fine. When you run your application you should be seeing message something like this -
Tomcat started on port(s): 8080 (http) with context path
. Sharing snapshot of the same belowMake sure you have added the required dependency like spring-boot-starter-web.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
If the first step is working fine for you, check whether request is reaching your respective controller endpoints you have defined, add log/print out statements and verify is it printing.
This step is optional to try, instead of checking in browser I would suggest start using rest client tools like postman, you will get to know what's the response code you received.
I hope this helps you to debug further.