茫茫網海中的冷日 - 對這文章發表回應
茫茫網海中的冷日
         
茫茫網海中的冷日
發生過的事,不可能遺忘,只是想不起來而已!
 恭喜您是本站第 1670939 位訪客!  登入  | 註冊
主選單

Google 自訂搜尋

Goole 廣告

隨機相片
IMG_60D_00294.jpg

授權條款

使用者登入
使用者名稱:

密碼:


忘了密碼?

現在就註冊!

對這文章發表回應

發表限制: 非會員 可以發表

發表者: 冷日 發表時間: 2016/9/16 8:50:27
Can't access Tomcat using IP address

I'm running a Tomcat 5.5 instance (port: 8089) on Windows 7.
The server runs correctly if I open http://localhost:8089/ but it gives me an error (Connection refused) on http://192.168.1.100:8089/
I thought it was a firewall issue...so I disabled it, but I still have no luck.
Thanks in advance.

SOLVED:
added address="0.0.0.0" to Connector string, it works! thanks a lot!



You need to make Tomcat listen to 192.168.1.100 address also.
If you want it to listen to all interfaces (IP-s) just remove "address=" from Connector string in your configuration file and restart Tomcat.
Or just use your IP to listen to that address address=192.168.1.100 in the Connector string



You need allow ip based access for tomcat in server.xml, by default its disabled. Open server.xml search for
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           URIEncoding="UTF-8"
           redirectPort="8443" />

Here add a new attribute useIPVHosts="true" so it looks like this,
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           URIEncoding="UTF-8"
           redirectPort="8443"
           useIPVHosts="true" />




New versions of application servers removed the ability of binding to your entire network interface and limited it just to the local interface (localhost). The reason being was for security. From what I know, Tomcat and JBoss implement the same security measures.
If you want to bind it to another IP you can explicitly set it in your connector string:
Tomcat: address="192.168.1.100"
JBoss: you pass in a -b 192.168.1.100 as a command line.
Just remember that binding 0.0.0.0 allows anyone access to your box to access that server. It will bind to all addresses. If that is what you want, then use 0.0.0.0, if it isn't then specify the address you would like to explicitly bind instead.
Just make sure you understand the consequences binding to all addresses (0.0.0.0)



If you are trying to access your web app which is running on apache tomcat server, it might be working perfect while you are trying to use it on http://localhost:8080/ , it will not work same if you are trying to access it on your mobile device browser for ex. chrome using http://192.168.x.x:8080/ so if you want to access via ip address on your remote/mobile device , do following settings
Open server.xml file.
Change
    <Connector connectionTimeout="20000" port="8080"protocol="HTTP/1.1" redirectPort="8443"/>

to.
    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" address="0.0.0.0" />

Save the file
Stop and restart the server
Now access on your mobile device using ip address http://192.168.1.X:8080/

冷日:
但事實上是,新版本的 Application server『預設只能 Localhost』!
所以,若我們要讓 Tomcat 可以透過 IP 服務的話,是要修改 server.xml 低!
原文出處:windows 7 - Can't access Tomcat using IP address - Stack Overflow
內容圖示
url email imgsrc image code quote
樣本
bold italic underline linethrough   












 [詳情...]
validation picture

注意事項:
預覽不需輸入認證碼,僅真正發送文章時才會檢查驗證碼。
認證碼有效期10分鐘,若輸入資料超過10分鐘,請您備份內容後,重新整理本頁並貼回您的內容,再輸入驗證碼送出。

選項

Powered by XOOPS 2.0 © 2001-2008 The XOOPS Project|