0

I installed Tomcat5 on CentOS 5.3, by default tomcat runs on port 8080 but i already have ISPConfig running on that port.

Port 80 is taken up by Apache

How do I know which port tomcat is listening on ? and if required change the port.

rzlines
  • 219
  • 6
  • 18
  • [Administration panels are off topic](http://serverfault.com/help/on-topic). [Even the presence of an administration panel on a system,](http://meta.serverfault.com/q/6538/118258) because they [take over the systems in strange and non-standard ways, making it difficult or even impossible for actual system administrators to manage the servers normally](http://meta.serverfault.com/a/3924/118258), and tend to indicate low-quality questions from *users* with insufficient knowledge for this site. – HopelessN00b Apr 03 '15 at 13:34

1 Answers1

2

In server.xml (usually in /etc/tomcat), there's a block starting

<Server port="xxxx">

or similar, where xxxx is the port your server is listening on, this will tell you where the server is listening. Changing the port is easy, just change this setting and restart tomcat.

Alternatively run netstat -anp and it will tell you which program is using which port.

Tom O'Connor
  • 27,480
  • 10
  • 73
  • 148
  • When I do a # netstat -lnp | grep 8005 I get tcp 0 0 ::ffff:127.0.0.1:8005 :::* LISTEN 6598/java But when I do localhost:8005 I dont get any web page, is the firewall blocking this port, if so how to enable access. – rzlines Nov 22 '09 at 18:25
  • 1
    That wasn't quite what i meant.. have a look at /etc/tomcat/server.xml, see what it's telling the tomcat server to run on as a port. It might not be 8005, it'll probably be 8080. If you've already got something using 8080, and it's bound, then there might be something in /var/log/tomcat/catalina.out (or catalina.log) about failed startup because the port is already used. – Tom O'Connor Nov 22 '09 at 18:28
  • The file is showing Server port="8005" and – rzlines Nov 22 '09 at 18:34
  • The netstat -anp command shows many lines, and I am probably missing the first few pages, how can I get a pagewise view of the ports list? – rzlines Nov 22 '09 at 18:37
  • 1
    Change the connector to be something other than 8080, maybe 8090, restart tomcat, then test it by browsing to localhost:8090 – Tom O'Connor Nov 22 '09 at 18:54
  • 1
    Oh, and to get a pagewise list of anything, pipe it into less, eg, `netstat -anp | less` Then you can use PgUp/PgDown and so on to scroll through it – Tom O'Connor Nov 22 '09 at 18:56
  • I changed the port to 8090 and now atleast I'm getting a blank page in my browser, on windows generally we get a Tomcat start page but on Centos I am not getting that. I checked the webapps folder and its empty probably that's the problem. Where as in windows the webapps folder has some root folders – rzlines Nov 22 '09 at 19:02
  • On ubuntu, the root of webapps/ contains an index.html akin to the Apache "It Works!" page. I think you can just put a html file into the webapp root and it'll serve it, or you can drop a .war file in, and tomcat will deploy it (depending on 'autoDeploy' setting in server.xml) – Tom O'Connor Nov 22 '09 at 20:57