0
votes

Tomcat is not responing to calls to localhost:8080

curl -k https://localhost/user-service/1/user

works fine, but

curl localhost:8080/user-service/1/user

hangs for hours and never responds.

netstat -tnlp

shows

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1504/sshd
tcp6 0 0 :::443 :::* LISTEN 1559/apache2
tcp6 0 0 :::9090 :::* LISTEN 19341/java
tcp6 0 0 :::46467 :::* LISTEN 19341/java
tcp6 0 0 127.0.0.1:8005 :::* LISTEN 19341/java
tcp6 0 0 :::8009 :::* LISTEN 19341/java
tcp6 0 0 :::8080 :::* LISTEN 19341/java
tcp6 0 0 :::80 :::* LISTEN 1559/apache2

but the localhost call doesn't even show up in the localhost access logs

We are running apache2, mod_jk, and tomcat8.

I see no errors. Any help would be greatly appreciated. Thanks!

1

1 Answers

0
votes

Your tomcat instance is expecting a IPv6 address connection to port 8080 (tcp6 denotes ipv6 connection).

To solve this in your TOMCAT_HOME\bin directory create a file called setenv.sh (if it doesn't already exist) and add the following

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

This will make tomcat bind to IPv4 upon restart.

You can check this by running your netstat command again and instead of seeing tcp6 for 8080 it should just say tcp