bestlong 怕失憶論壇

 

 

搜索
bestlong 怕失憶論壇 論壇 Java JBoss JBoss 只能本機 localhost:8080 連接但其他電腦無法顯示 ...
查看: 14549|回復: 3
go

JBoss 只能本機 localhost:8080 連接但其他電腦無法顯示網頁 [複製鏈接]

Rank: 9Rank: 9Rank: 9

1#
發表於 2007-6-14 17:38 |只看該作者 |倒序瀏覽 |打印
下載 JBoss 4.2.0.GA 安裝啟動後
本機可以用 http://localhost:8080 或是 http://127.0.0.1:8080 顯示網頁。
但是使用 http://xxx.xxx.xxx.xxx:8080 主機 IP 或網址的方式都無法顯示網頁
其他電腦連接也都是無法顯示網頁
我是雪龍
http://blog.bestlong.idv.tw
http://www.bestlong.idv.tw

Rank: 9Rank: 9Rank: 9

2#
發表於 2007-6-14 18:05 |只看該作者
這是 JBoss-4.2.0.GA 的 jboss.bind.address 預設值的問題

連入 http://localhost:8080/ 檢視 JBoss Web Console  檢查 system 內容發現 jboss.bind.address 被指定為 127.0.0.1 的 IP 值,所以只會回應連接 127.0.0.1 的請求。

因為我是新手所以還不太了解 *.xml 的設定方式,所以不知道可以設定在哪個檔案以及設定的格式。

不過可以先用 run.bat / run.sh 指定參數的方式解決
只要加上 -b 0.0.0.0 可以了參考如下

  1. %JBOSS_HOME%\bin>run.bat -b 0.0.0.0
複製代碼


這樣 JBoss 主機不管有多少 IP 都會監聽回應了。
我是雪龍
http://blog.bestlong.idv.tw
http://www.bestlong.idv.tw

Rank: 9Rank: 9Rank: 9

3#
發表於 2012-1-14 10:49 |只看該作者
若要知道 run.bat /run.sh 還有哪些參數可以用可以用 -h 來查看
  1. C:\jboss-4.2.3.GA\bin>run.bat -h
  2. ===============================================================================

  3.   JBoss Bootstrap Environment

  4.   JBOSS_HOME: C:\jboss-4.2.3.GA

  5.   JAVA: C:\Program Files\Java\jdk1.6.0_29\bin\java

  6.   JAVA_OPTS:  -Dprogram.name=run.bat -server -Xms128m -Xmx512m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.ser
  7. ver.gcInterval=3600000

  8.   CLASSPATH: C:\Program Files\Java\jdk1.6.0_29\lib\tools.jar;C:\jboss-4.2.3.GA\bin\run.
  9. jar

  10. ===============================================================================

  11. usage: run.bat [options]

  12. options:
  13.     -h, --help                    Show this help message
  14.     -V, --version                 Show version information
  15.     --                            Stop processing options
  16.     -D<name>[=<value>]            Set a system property
  17.     -d, --bootdir=<dir>           Set the boot patch directory; Must be absolute or url
  18.     -p, --patchdir=<dir>          Set the patch directory; Must be absolute or url
  19.     -n, --netboot=<url>           Boot from net with the given url as base
  20.     -c, --configuration=<name>    Set the server configuration name
  21.     -B, --bootlib=<filename>      Add an extra library to the front bootclasspath
  22.     -L, --library=<filename>      Add an extra library to the loaders classpath
  23.     -C, --classpath=<url>         Add an extra url to the loaders classpath
  24.     -P, --properties=<url>        Load system properties from the given url
  25.     -b, --host=<host or ip>       Bind address for all JBoss services
  26.     -g, --partition=<name>        HA Partition name (default=DefaultDomain)
  27.     -u, --udp=<ip>                UDP multicast address
  28.     -l, --log=<log4j|jdk>         Specify the logger plugin type

  29. 請按任意鍵繼續 . . .
  30. C:\jboss-4.2.3.GA\bin>
複製代碼
我是雪龍
http://blog.bestlong.idv.tw
http://www.bestlong.idv.tw

Rank: 9Rank: 9Rank: 9

4#
發表於 2012-1-14 11:38 |只看該作者
在 run.bar -b 0.0.0.0 的目的就是將 JBoss 的 jboss.bind.address 屬性指定為 0.0.0.0
這樣在啟動載入各項 xml 設定檔時,就會將 ${jboss.bind.address} 代入 0.0.0.0

所以可以透過直接修改 xml 內的設定解決

jboss-4.0.5.GA\server\default\deploy\jbossweb-tomcat55.sar\server.xml
找到下列內容
  1.       <!-- A HTTP/1.1 Connector on port 8080 -->
  2.       <Connector port="8080" address="${jboss.bind.address}"
  3.          maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
  4.          emptySessionPath="true"
  5.          enableLookups="false" redirectPort="8443" acceptCount="100"
  6.          connectionTimeout="20000" disableUploadTimeout="true"/>
複製代碼
修改成
  1.       <!-- A HTTP/1.1 Connector on port 8080 -->
  2.       <Connector port="8080" address="0.0.0.0"
  3.          maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
  4.          emptySessionPath="true"
  5.          enableLookups="false" redirectPort="8443" acceptCount="100"
  6.          connectionTimeout="20000" disableUploadTimeout="true"/>
複製代碼
另一個 JBoss 版本

jboss-4.2.3.GA\server\default\deploy\jboss-web.deployer\server.xml

找到下列內容
  1.     <Connector port="8080" address="${jboss.bind.address}"   
  2.          maxThreads="250" maxHttpHeaderSize="8192"
  3.          emptySessionPath="true" protocol="HTTP/1.1"
  4.          enableLookups="false" redirectPort="8443" acceptCount="100"
  5.          connectionTimeout="20000" disableUploadTimeout="true" />
複製代碼
將其修改成
  1.     <Connector port="8080" address="0.0.0.0"   
  2.          maxThreads="250" maxHttpHeaderSize="8192"
  3.          emptySessionPath="true" protocol="HTTP/1.1"
  4.          enableLookups="false" redirectPort="8443" acceptCount="100"
  5.          connectionTimeout="20000" disableUploadTimeout="true" />
複製代碼
這樣就會讓 8080 埠接收所有連線

雖然處理上有些繁瑣,不過,因為 ${jboss.bind.address} 在很多設定位置都有用到,所以啟動時在 run.bat 指定 -b 是全面性的影響,也就是將所有服務都對外打開了門,這樣的處理方式必然是提高資安風險。
‹ 上一主題|下一主題

Archiver|怕失憶論壇

GMT+8, 2024-4-27 09:06 , Processed in 0.011708 second(s), 11 queries .

Powered by Discuz! X1.5

© 2001-2010 Comsenz Inc.