0
votes

how do I deploy different spring boot wars on tomcat container I have 3 wars with name

myapp1.war

myapp2.war

myapp3.war

I have added these wars into tomcat webapps folder and did some changes in server.xml under <Host? tag.

<Context path="/apipath" docBase="myapp1" reloadable="true"></Context>

I can access the application on http://localhost:9080/apipath/mymethoduriapp1 Now if I put another Context path in same host tag for other war like

<Context path="/apipath" docBase="myapp2" reloadable="true"></Context>

server unable to start now.

is there any way that we can have multiple context path so I can access all application on same port. example.

http://localhost:9080/apipath/mymethoduriapp1

http://localhost:9080/apipath/mymethoduriapp2

http://localhost:9080/apipath/mymethoduriapp3

Thanks in advance for help

1
If you do not add a docbase, it will automatically consider all wars in webapp folder and deploy them.Sridhar Patnaik
thank you for your response, Agree it is now considering web app folder but path taking as wars name not from context path as specified above /apipathkiran rathod

1 Answers

-1
votes

No you can't have multiple apps listening on the same port. How would the kernel know which application to send the packages to? What you can do that run a http server such nginx or apache which gonna listen on 9090 and each app in a different port and then proxy the requests based on the URL to the desired app.

nginx is probably the most popular and easier to setup , Below shows the basic configuration for this case

Nginx Reverse Proxy. Multiple Applications on One Domain