0

I have a REST web application that is running in Tomcat. I can access this RESTful service with http://localhost:8080/MyApplication/Myresource.

How can I configure Tomcat so that this webapp runs on a different port while other webapps continue to run on port 8080 or on another port? Specifically, I want to access

http://localhost:XXXX/MyApplication/Myresource

and

http://localhost:YYYY/OtherApplication/Resource
Aleks G
  • 56,435
  • 29
  • 168
  • 265
gpiscite
  • 23
  • 7
  • Similar Question[Changing Tomcat Http Port][1] [1]: http://stackoverflow.com/questions/4756039/how-to-change-the-port-of-tomcat-from-8080-to-80 – AsSiDe Oct 30 '14 at 08:57

2 Answers2

1

ITS SIMPLE , JUST SEE THIS IMAGE enter image description here

VedantK
  • 9,728
  • 7
  • 66
  • 71
0

In server.xml file inside the conf dir, there's the http connector definition:

<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />

Change the 8080 value to whatever else you need and restart tomcat.

If you want to have some apps run on one port and other apps on another port, then you should have a look at this question

Community
  • 1
  • 1
Aleks G
  • 56,435
  • 29
  • 168
  • 265
  • but in this case i have all application in tomcat on port XXXX that i set in connector?! If i want two application with http://localhost:XXXX/MyApplication/Myresource and http://localhost:YYYY/MyApplication2/Myresource ? Thanks – gpiscite Oct 30 '14 at 09:01
  • @gpiscite In that case, have a look at [this question](http://stackoverflow.com/questions/8823290/how-to-run-different-apps-on-single-tomcat-instance-behind-different-ports) – Aleks G Oct 30 '14 at 09:08
  • Thanks @Aleks G . So It is impossibile to have each application with its door in one TomCat Instance? I got it right? Thanks in advances. – gpiscite Oct 30 '14 at 09:10
  • @gpiscite Yes, it it possible, but you have to specify this in the tomcat config file - you cannot specify this inside your apps. – Aleks G Oct 30 '14 at 09:13
  • okkey! thanks . I read a post linked. So I can have two application with two different port but i lose the gerarchy. I can have localhost:XXXX/Myresource and localhost:YYYY/Myresource, but no localhost:XXXX/MyApplication/Myresource and localhost:YYYY/MyApplication2/Myresource ?! – gpiscite Oct 30 '14 at 09:21