Tomcat IPv4 over IPv6


You can use IPv4 as default instead of IPv6.


IPv4 instead of IPv6

The easiest way is to change the JAVA_OPTS variable.


Edit your Tomcat launcher (instance) script:

# Package installation
vim /etc/default/tomcat7

# Manual installation, Tomcat instance
vim /etc/init.d/tomcat8


Adjust your JAVA_OPTS line, add -Djava.net.preferIPv4Stack=true

JAVA_OPTS="${JAVA_OPTS} -Djava.net.preferIPv4Stack=true"


Take changes into account

service tomcat7 restart