开发者

Why does Tomcat start with 0.0.0.0:8000 open?

开发者 https://www.devze.com 2023-03-10 00:00 出处:网络
I know the short answer is \"You told it to.\" But of course, I\'m not sure how I told Tomcat to start with the 8000 default debug port open, but on 0.0.0.0 instead of the expected 127.0.0.1. Here\'s

I know the short answer is "You told it to." But of course, I'm not sure how I told Tomcat to start with the 8000 default debug port open, but on 0.0.0.0 instead of the expected 127.0.0.1. Here's a couple of context commands directly after Ubuntu 10.10 boots.

$ netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN     
tcp6       0      0 127.0.0.1:8080          :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN     

/usr/share/tomcat6/bin$ grep -C 5 8000 catalina.sh
#
#   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
#                   command is executed. The default is "dt_socket".
#
#   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
#                   command is executed. The default is 8000.
#
#   JPDA_SUSPEND    (Optional) Java runtime options used when the "jpda start"
#                   command is executed. Specifies whether JVM should suspend
#                   execution immediately after startup. Default is "n".
#
--
if [ "$1" = "jpda" ] ; then
  if [ -z "$JPDA_TRANSPORT" ]; then
    JPDA_TRANSPORT="dt_socket"
  fi
  if [ -z "$JPDA_ADDRESS" ]; then
    JPDA_ADDRESS="8000"
  fi
  if [ -z "$JPDA_SUSPEND" ]; then
    JPDA_SUSPEND="n"
  fi
  if [ -z "$JPDA_OPTS" ]; then

Given these two outputs, I expect to find out that there's a further configuration file somewhere that I unknowingly modified, since the only way that catalina.sh would open 8000 is if it was passed the jpda switch, and even then it seems like it will start on lo开发者_开发百科calhost and no 0.0.0.0. .bashrc is clean of tomcat tomfoolery, and I'm stumped where else to look!


Time to brush up on RFC4632, memory got rusty.

0.0.0.0 is the default route, and in the case of Tomcat is used to indicate that any IP on port 8000 will be routed into Tomcat (presumably for debugging).

To restate, on Tomcat 0.0.0.0:xxxx will route any request with xxxx port into Tomcat.


That could be becuase the JPDA_ADDRESS is "8000" and not "localhost:8000" if [ -z "$JPDA_ADDRESS" ]; then JPDA_ADDRESS="localhost:8000" fi

0

精彩评论

暂无评论...
验证码 换一张
取 消