0

I have a spring boot web application it is running fine when started from the IDE(I am using Spring Tool Suite) When I deploy to an external tomcat it is showing errors in all the places. When I run it from the IDE I use http://localhost:8080/login

When I run it from the external tomcat I use http://localhost:8080/webapp/login

the challenge is that I can't even get the styles populated properly from External Tomcat where as everything is fine when run from the embedded tomcat server.

Error resolving template [folder/page], template might not exist or might not be accessible by any of the configured Template Resolvers

Is there something I am missing in the configuration? In short I can say, It seems my application is failing when I use the War Name as the application root context do i have to mention the war name in the controller while returning the views? if yes, then how? I have tried and it didn't work

Amani Musomba
  • 11
  • 1
  • 4

1 Answers1

0

If you want to have the same behavior (/login and not /webapp/login) for the deployment of the application to your external Tomcat, you should configure the context path.

There are multiple ways to achieve this:

  1. Name your .war file ROOT.war and place it in webapps directory
  2. Follow the different ideas from this question: How to set the context path of a web application in Tomcat 7.0
rieckpil
  • 10,470
  • 3
  • 32
  • 56
  • Thanks for the response, I managed to get it to work by Doing Step 1 The Strange thing is that it works on windows but not on Linux,(Looks like tomcat can't find the deployed and exploded war) working on the fix for windows – Amani Musomba Mar 14 '20 at 15:06
  • great to hear this, can you mark this answer as correct, so that other developers inthe future benefit from this? Regarding the difference on Linux you might open a new question on StackOverflow – rieckpil Mar 14 '20 at 15:11