Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion

Tomcat 7 listening on IPv6 but not on IP4!!
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Tomcat 7 listening on IPv6 but not on IP4!!

sidahmedsidahmed Member
edited July 2014 in Help

Hi!
I have Ubuntu 14.04 with tomcat 7 installed, but as the title says, I couldn't make it to listen on IP4. SSH and Postgresql are listening on both IP4 and IP6 and every thing else looks fine. this looks like Java issues, so how can I make it listen on both?

Here is the content of /etc/network/interfaces:

auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp iface eth0 inet6 auto

I use oracle java version "1.7.0_65", and it was working (on IP4 as well) before I installed GeoServer (war file) on tomcat7.

PS: i have no firewall installed and i don't want to disable IPv6.

I appreciate if any one can help me here!

Comments

  • It works by adding the following lines to /etc/sysctl.conf

    net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1

    and then run sudo sysctl -p, as described here:
    https://forums.aws.amazon.com/thread.jspa?messageID=406171

  • ScionScion Member

    You don't have to disable ipv6 to do this. Start Tomcat with the following VM argument:

    -Djava.net.preferIPv4Stack=true
    

    By default Java "prefers" ipv6 if it's available. That setting makes it prefer ipv4 instead.

    Thanked by 1sidahmed
  • Thanks Scion!
    Even after I restored the original settings, tomcat start to listen on IP4 from itself. I even did a fresh system re-install to see this error, but it never happens again!
    Any how I added the line you suggested, just in case.

    Thanks

Sign In or Register to comment.