2

I have two web applications, which I want to be running under the one tomcat instance, but on a different ports to connect, for example first war - under 8080, and second - 8090. Is it possible to do using just two connectors in the server.xml?

So to connect to first app - i'll use address http://localhost:8080/myFirstApp and for second - http://localhost:8090/mySecondApp. How can I do this without running two tomcat innstances on the localhost?

3 Answers 3

3

There's no problem with running two connectors.

But if you want to have each app accessible on different port and only there (not on both/all ports), copy Service part in conf/server.xml changing the ports and names so that there's no conflict.

You'll have to specify different webapps directories for both Services and put each of your webapps in different one.

Sign up to request clarification or add additional context in comments.

Comments

3

http://www.mulesoft.com/tomcat-connector

Now let's assume that we want to change this configuration, so that instead of receiving two responses for every request received by either Connector, we want each Connector to pass requests from its port only to one specific web application. To achieve this functionality, we simply need to rearrange the element hierarchy so that it resembles something like this:

<Server> <Service name="Catalina"> <Connector port="8443"/> <Engine> <Host name="yourhostname"> <Context path="/webapp1"/> </Host> </Engine> </Service> <Service name="Catalina8444"> <Connector port="8444"/> <Engine> <Host name="yourhostname"> <Context path="/webapp2"/> </Host> </Engine> </Service> </Server> 

Comments

2

Well, I think you can declare the two connectors with different ports and they will run properly. But you can't limit the access to apps via configuration. That is - both apps will be accessible on both ports. If you need to limit that, make a Filter that checks and returns 404.

9 Comments

thanks, I don't need the limiting actually.. I just want to limit thread pool for every app to be not shared. so that if one application is very busy and does not have any free threads in pool - other app will be still accessible via other port - as thread pools should be different and not shared for diff connectors, right?
I guess so, yes. But you can have in-application thread-pools as well that are not shared. I wouldn't make a connector only for the sake of thread pools
why, what's bad with having a two or more connectors?
nothing, but you shouldn't use them for the wrong reason. If the reason is connection pools - there are better solutions.
Actually it's not true. You can achieve this: mulesoft.com/tomcat-connector see Nesting Connector Elements
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.