Im trying to run my web server in VPS based on ubuntu 14.04. As i tried before on other systems i can check if my tomcat is fine, by going to _http://myIp:8080 and see "It works" index page, but not this time. And honestly im going crazy because i cant figure whats wrong.
I installed tomcat just with command

 apt-get install tomcat7

All was fine. I checked that port 8080 is open and went to _http://myIp:8080 - and nothing happens. I can't see 404 (that would mean that tomcat managed request) and I cant see "connection failed" (that would mean, that port is closed or thmthng). Connection is just hangs.

I tried to change tomcat port to 1666 (of course, i turned off ufw firewall) Reloaded server, and ROOT deployment was fine again. But i still cant get anything from my server (answer or error) _http://myIp:1666

Here is catalina start log.

And there is nothing except deployment logs.

I have reinstalled tomcat couple of times, but still no result.


i killed my old VPS and created new one. installed tomcat 7 via apt-get again so he is listening to 8080. and here is my grep result

netstat -na | grep -e 1666 -e 8080
tcp6       0      0 :::8080                 :::*                    LISTEN

OMG doez it means that tomcat binds to ipV6 and i trying to get my page via ipV4?


I created senenv.sh for tomcat with

JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true"

and now my tomcat listening to ipv4 tcp. But still no result. When i trying to connect myIP:8080 there is nothing happens/

-na | grep -e 1666 -e 8080
tcp        0      0  *               LISTEN


IT F***g works.
I missed why, i just spend 10 more minutes in internet after restarting tomcat, trying to find something to solve my problem. And then i tried to get myIP:8080 again - and i saw "It works" index page.

  • How did you checked the port is open? where is the socket port binded? localhost? *? your ip? Can you post the output of "ss -lntp | grep -e 1666 -e 8080" or "netstat -na | grep -e 1666 -e 8080"?
    – Idaho06
    Dec 30, 2014 at 18:46
  • updated my question. I checked with ping.eu - this is good site for such sings
    – Asprelis
    Dec 31, 2014 at 8:32

1 Answer 1


Core problem was that tomcat listens to ipv6 tcp port. I tried to get to my page via ipv4 adress. So i created setenv.sh in /usr/share/tomcat7/bin with single line

JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true"

and restarted tomcat via

sudo bash tomcat7 restart

in /etc/init.d Then checked my port again with

netstat -na | grep -e 8080

and saw, that ipv4 is using now

tcp        0      0  *               LISTEN

And after few minutes i could get to my index.html

Thanx @Idaho06 for

netstat -na | grep -e 8080

I would never found problem without it

  • i think it must be setenv.sh, not setenc.sh
    – Lokomotywa
    Apr 19, 2016 at 15:48
  • @ Ferenjito Thanx! Fixed.
    – Asprelis
    Apr 21, 2016 at 11:45
  • @Asprelis can you please share why binding to ipv6 can be a problem? In my case a TCP connection is setup but server doesn't respond back. I would like to dig deeper. Jun 4, 2020 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.