JBOSS 點滴

          豐豐的博客

          Could not obtain connection to any of these urls:

          錯誤:
          Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: 192.168.17.105:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server /192.168.17.105:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /192.168.17.105:1099 [Root exception is java.net.ConnectException: Connection refused: connect]]]
              at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1725)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:689)
              at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
              at javax.naming.InitialContext.lookup(InitialContext.java:392)
              at test.Client.main(Client.java:29)
          處理:
          在本文中將編寫一個簡單的無狀態SessionBean。在發布EJB時,一般需要將EJB程序以jar文件的形式進行發布。這些jar文件將被放在<JBoss安裝目錄>\server\default\deploy目錄中。如果在Eclipse中開發EJB程序,需要進行一些配置。首選需要在首選項(Preferences)對話框中設置JBoss的安裝目錄(如D:\jboss5)。然后在運行配置對話框中添加jboss的運行項。在jboss4.2及以后的版本中,默認情況下jboss只接收來自localhost或127.0.0.1的請求,也就是只接收本地的訪問。為了使jboss接收來自其他地址的請求,在啟動jboss時需要使用-b命令行參數進行設置。如下面的啟動命令所示:

          run.bat -b 200.200.200.123
          run.bat -b 
          0.0.0.0

              上面的第一行命令表示jboss可以接收來自200.200.200.123的請求。第二條命令表示jboss可以接收來自任意地址的請求。如果不設置-b參數,以非本機方式訪問EJB時,JBoss會拋出如上異常:

          posted on 2009-06-02 17:22 半導體 閱讀(5644) 評論(6)  編輯  收藏 所屬分類: EJB

          評論

          # re: Could not obtain connection to any of these urls: 2009-06-25 14:11 DB

          補充下:剛學時候容易把端口寫成8080,那是TOMCAT的端口,JNDI應該設成1099  回復  更多評論   

          # 非常好 2010-11-22 22:35 farseer

          太感謝了,找了好久才找到怎么解決,謝謝樓主  回復  更多評論   

          # re: Could not obtain connection to any of these urls: 2010-12-28 14:35

          太感謝了,困擾了我一下午,覺都沒睡好  回復  更多評論   

          # re: Could not obtain connection to any of these urls: 2011-01-13 12:00 半導體

          @DB
          恩,補充得是!  回復  更多評論   

          # re: Could not obtain connection to any of these urls: [未登錄] 2012-05-11 23:38 java

          問題得意解決、感謝樓主!!!  回復  更多評論   

          # re: Could not obtain connection to any of these urls: 2013-12-31 13:24

          請問可以吧在哪里改具體說清楚嗎  回復  更多評論   

          主站蜘蛛池模板: 呼图壁县| 祁阳县| 昌吉市| 建始县| 衡南县| 军事| 丹阳市| 梁河县| 游戏| 黄骅市| 霸州市| 陇南市| 香港 | 炎陵县| 万安县| 随州市| 田阳县| 济源市| 勃利县| 浙江省| 乌鲁木齐市| 客服| 确山县| 依兰县| 宾川县| 新余市| 平遥县| 项城市| 维西| 长葛市| 尼勒克县| 兴国县| 和平县| 襄汾县| 汝州市| 南岸区| 吉木萨尔县| 招远市| 南漳县| 获嘉县| 三亚市|