0

I'm currently trying to deploy a simple web app with Eclipse on a tomcat server.

Everything looks fine when i launch the server through Eclipse. localhost:8080 is working fine and displays the tomcat home page.

However, my app "tutorial-web-spring" is not reachable as localhost:8080/tutorial-web-spring triggers a 404.

My app has been well added to my server on the eclipse server tab ...

Btw, I changed my configuration so eclipse use tomcat installation folder and not workspace metadata.

Patrick
  • 5,526
  • 14
  • 64
  • 101
Q. Ber
  • 13
  • 1

1 Answers1

0

The Context Path By default, the context path is “/”. If that’s not ideal and you need to change it – to tutorial-web-spring, here’s the quick and simple way to do it via application.properties (spring bot App):

server.contextPath=/tutorial-web-spring

And for YAML-based configuration:

server:
    contextPath:/tutorial-web-spring

Finally – the change can be done programmatically as well:

@Component
public class CustomizationBean
  implements EmbeddedServletContainerCustomizer {

    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
        container.setContextPath("/tutorial-web-spring");
    }
}

SOURCE

AchillesVan
  • 4,156
  • 3
  • 35
  • 47