0
votes

I have been working on Spring Boot Rest API using MongoDB with embedded Tomcat for about a month now to build a REST API. Everything was working fine. I now want to deploy the API in a separate development environment so that anybody can access the API.

I followed the step mentioned at http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-create-a-deployable-war-file

  1. Change the packaging to war
  2. Added this to my pom.xml provided for spring-boot-starter-tomcat
  3. extends my application to SpringBootServletInitializer and overwrote the configure method.
  4. my application.properties has this:
    spring.data.rest.base-path=/

After doing all these: I tried accessing the URL localhost:8080/my-war-name/employees it gives me 404 error but if I run the same application as standalone like via main() or run as Spring Boot. I can access my API at localhost:8080/employees

Am I missing something? Any help would be appreciated.

1
can you provide the log output from tomcat during deployment? which tomcat version are you deploying to?Lutz Müller
Hi, could you find a solution for this case ?AknKplnoglu

1 Answers

1
votes

Have you tried localhost:8080/employees ?

It depends what the app- context path, if you want localhost:8080/my-war-name/employees you can add

server.context-path=my-war-name to application.properties More on config