wood burning stoves 2.0*
The moose likes Tomcat and the fly likes available server ports on Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "available server ports on Tomcat" Watch "available server ports on Tomcat" New topic
Author

available server ports on Tomcat

scott ja
Greenhorn

Joined: Jul 12, 2012
Posts: 8
Installed and started the Tomcat 7 on Linux. Java 6.


What is the allowed range for the ports in addition to the 8080. I intend to run multiple Apps on the same server. So if the 8080 is taken, I'll need to use a different one for another app. In which XML file to specify the port (server.xml or context.xml)?


Thanks


Eugene
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12756
    
    5
I intend to run multiple Apps on the same server.


Why do you think each app needs a separate port?

This is an HTTP server we are talking about, any number of apps can be handled by virtue of having separate URL addresses, all using the same connector port.

Go through the examples that come with Tomcat to see multiple apps running on the same port.

The Comments in web.xml, server.xml, and context.xml will help you.

Bill
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

Re-iterated for emphasis: a single Tomcat instance listening on a single port can handle any number of applications.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
scott ja
Greenhorn

Joined: Jul 12, 2012
Posts: 8
This is what I intended to do:

http://192.168.1.10:8080/Test for one app and another app is,

http://192.168.1.10:8083/Test

With all the other info kept the same except the port numbers.


I do not want to do:

http://192.168.1.10:8080/Test1 and
http://192.168.1.10:8080/Test2



Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60741
    
  65

Why? Other than "I want to", that is. Tomcat is set up to handle the customary way; why swim upstream to do things differently without a very good reason?
scott ja
Greenhorn

Joined: Jul 12, 2012
Posts: 8
The Tomcat will be installed on the same machine as the Eclipse IDE. To keep the development and production as identical as possible, the web app on the development environment will be named exact the same as the testing environment, such as TestApp for both, that is,

http://192.168.1.10:8080/TestApp (for development)
http://192.168.1.10:8083/TestApp (for testing)

By this way, if testing is passed, in the production, I only need to deploy to the production server and use the exact setting such as: http://192.168.1.11:8083/TestApp, without toggling the name such as TestApp and ProdApp.

I just tried to make sure that if I want to use different ports for separate apps, I actually can.

And what is the range for the ports which I can use including the 8080. And how can I determine which ports are allowed for http on Tomcat?


Thanks

P.S. Currently I am using IBM's Websphere on which I use :9080 for development and 9083 for testing something like:

http://192.168.1.10:9080/TestApp (for development)
http://192.168.1.10:9083/TestApp (for testing)

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

J2EE webapp servers are based on the idea that one server can - and often will - host multiple webapps. The distinction is based not on the port number, but on the context path that is associated with the webapp. This is just as true in WebSphere as it is in Tomcat.

The Tomcat server essentially consists of building blocks that are wired together according to the schema mapped out in the Tomcat server.xml file. Ports are defined as Connectors within a Service, and the Service also contains an Engine. Requests coming in on the Connectors are routed by the Service to the Engine, which then sends them down the pipeline to whichever webapp the context path in the URL indicates that the request should be handled by.

Setting up an entirely new Service for gratuitous purposes is rather messy. As long as you're at it, you might as well simply clone the entire server and run 2 separate Tomcats.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: available server ports on Tomcat
 
Similar Threads
Running as one process
Servlet HelloWorld problem
Tomcat5.5
Tomcat and sockets for receiving and transmiting data
Not able to start sun app server CLI156 error.