wacik93
wacik93

Reputation: 293

URL issue while deploying war file in Tomcat

When I deploy my app in dev environment it works fine. When I try to deploy it on production environment, Tomcat gives additional path parameter which cause problems in my app.

Example: localhost:port/home.html -> localhost:port/AppName/home.html

Same goes to static resources eg. My Image is located at adress: localhost:port/static/index.jpg and on production env I need to put localhost:port/AppName/static/index.jpg

Is there any Spring configuration that helps to aovid that? Do you know any solutions for this problem?

Upvotes: 1

Views: 928

Answers (2)

Prashant Thorat
Prashant Thorat

Reputation: 1812

Simple solution without changing your server configuration.delete ROOT.war from your server and paste your war here rename it as ROOT.war.

Second solution is find your server.xml. add context here

 <Context path="/" docBase="your application name here" reloadable="true" />

don't forget path="/". And change if existing source has the path "/" to something else so it will not conflict.

Upvotes: 1

Hellzzar
Hellzzar

Reputation: 195

It seems other people have already ask themselves the same question. These answers may help you (You just need to name you app as root.war):

Detailed explanation

Short one

Upvotes: 0

Related Questions