2011-06-01 61 views
0

我知道簡短的答案是「你告訴它。」但是當然,我不知道我是如何告訴Tomcat開始打開8000默認調試端口,而是在0.0.0.0而不是預期的127.0.0.1。在Ubuntu 10.10啓動之後,這裏有幾個上下文命令。爲什麼Tomcat以0.0.0.0:8000打開?

$ 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 

鑑於這兩個輸出,我希望找到的是有地方進一步配置文件,我在不知不覺中修改,因爲這catalina.sh將打開8000是,如果它是通過jpda開關,即使在當時的唯一途徑它似乎將開始在localhost和沒有0.0.0.0.bashrc是乾淨的tomcat tomfoolery,我很難看到別的地方看!

回答

1

時間刷上RFC4632,記憶變得生鏽。

0.0.0.0是default route,和在Tomcat中的情況下被用來指示任何 IP端口8000將被路由到Tomcat(據推測爲調試)。

重申,在Tomcat 0.0.0.0:xxxx將任何請求與xxxx端口路由到Tomcat。