Go to tomcat home -> conf
There is a file called server.xml, in that search for 8080 and replace it with 8180 and restart the tomcat.
Question
I found the message telling me that the ports required by Tomcat are already in use.
netstat -an|grep 8080
tcp6 0 0 :::8080 :::* LISTEN
netstat -an|grep 8005
tcp6 0 0 127.0.0.1:8005 :::* LISTEN
So,I created the file tcp6.js
using Node.js
and bound it to 9000
:
var net=require('net');
var chat=net.createServer();
chat.on('connection',function(client){
client.write('Die');
client.end();
});
chat.listen(9000);
I logged out and logged back in. But the netstat still shows tcp6 bound to 8080 and 8005. These are the results of
ps aux | grep tomcat
tomcat7 2862 0.1 1.4 1960116 106080 ? Sl Mar19 1:46 /usr/lib/jvm/default-
java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat7/conf/logging.properties -
Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC -
Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -
Djava.endorsed.dirs=/usr/share/tomcat7/endorsed -classpath
/usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar -
Dcatalina.base=/var/lib/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -
Djava.io.tmpdir=/tmp/tomcat7-tomcat7-tmp org.apache.catalina.startup.Bootstrap start
anr 18444 0.0 0.0 13636 940 pts/2 S+ 11:46 0:00 grep --colour=auto
tomcat
Error printed in Eclipse Console:
org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false],
isDirectory: [false], canRead: [false]
org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false],
isDirectory: [false], canRead: [false]
org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false],
isDirectory: [false], canRead: [false]
org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false],
isDirectory: [false], canRead: [false]
org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false],
isDirectory: [false], canRead: [false]
org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false],
isDirectory: [false], canRead: [false]
org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8180"]
org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1678 ms
org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.35
org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8180"]
org.apache.catalina.startup.Catalina start
INFO: Server startup in 2199 ms
Solution
Go to tomcat home -> conf
There is a file called server.xml, in that search for 8080 and replace it with 8180 and restart the tomcat.
OTHER TIPS
In your tomcat installation directory find server.xml and change port their.
You can do things depending on situation
1) If you are running tomcat within eclipse do this ::
Go to Servers tab, if not visible then go to menu bar window->show view-> Servers Then Double click on the server you have created(if not then create one) on the right side you will see port numbers 8080, 8009,8005 change all of them to anything above 9000 like 9001, 9002 ,9003. Ctrl + save Restart your server it will run now
2) If you are running Tomcat with out Eclipse i.e tomcat as a Service (do this when you have shut down tomcat) Go to Tomcat installation directory
go to conf-> and open servers.xml with notepad, now find and replace 8080,8009,8005 with 9001,9002,9003 or any port above 9000,
do Ctrl+save
Restart tomcat as Service
what you just did is you changed the default port numbers that tomcat runs on !!! :)