2014-05-22 557 views
4

我在連接到WildFly 8.0.0.Final上的JMS時遇到問題。將獨立Java程序連接到WildFly服務器上的JMS時出錯

我正在使用獨立的Java程序,其源代碼與WildFly快速入門示例中的HelloWorldJMSClient.java的確切副本相同。

我遵循provided instructions,並添加了quickstartUser並配置爲JMS

與管理控制檯中,我可以看到RemoteConnectionFactory

enter image description here

和創建的測試隊列

enter image description here

我有獨立的完整的配置WildFly開始

enter image description here

服務器啓動,看似成功完成所有步驟,包括JMS(HornetQ的)綁定:

C:\WildFly8\wildfly-8.0.0.Final\bin\standalone.bat -c standalone-full.xml 
Calling "C:\WildFly8\wildfly-8.0.0.Final\bin\standalone.conf.bat" 
Setting JAVA property to "C:\Program Files\Java\jdk1.8.0_05\bin\java" 
Detected server admin port: 9990 
Detected server http port: 8080 
=============================================================================== 

    JBoss Bootstrap Environment 

    JBOSS_HOME: "C:\WildFly8\wildfly-8.0.0.Final" 

    JAVA: "C:\Program Files\Java\jdk1.8.0_05\bin\java" 

    JAVA_OPTS: "-XX:+UseCompressedOops -Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman" 

=============================================================================== 

10:39:36,154 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final 
10:39:37,741 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.0.Final 
10:39:37,842 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.0.0.Final "WildFly" starting 
10:39:42,278 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http) 
10:39:42,328 INFO [org.xnio] (MSC service thread 1-5) XNIO version 3.2.0.Final 
10:39:42,337 INFO [org.xnio.nio] (MSC service thread 1-5) XNIO NIO Implementation Version 3.2.0.Final 
10:39:42,400 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 36) JBAS010280: Activating Infinispan subsystem. 
10:39:42,402 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 47) JBAS011800: Activating Naming Subsystem 
10:39:42,396 INFO [org.jboss.as.security] (ServerService Thread Pool -- 52) JBAS013171: Activating Security Subsystem 
10:39:42,428 INFO [org.jboss.as.jacorb] (ServerService Thread Pool -- 37) JBAS016300: Activating JacORB Subsystem 
10:39:42,454 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 56) JBAS015537: Activating WebServices Extension 
10:39:42,523 INFO [org.jboss.as.security] (MSC service thread 1-2) JBAS013170: Current PicketBox version=4.0.20.Final 
10:39:42,577 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 43) JBAS012615: Activated the following JSF Implementations: [main] 
10:39:42,661 INFO [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service 
10:39:42,666 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default] 
10:39:42,776 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) JBAS017502: Undertow 1.0.0.Final starting 
10:39:42,776 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) JBAS017502: Undertow 1.0.0.Final starting 
10:39:42,819 INFO [org.jboss.as.connector.logging] (MSC service thread 1-1) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.3.Final) 
10:39:43,053 INFO [org.jboss.remoting] (MSC service thread 1-4) JBoss Remoting version 4.0.0.Final 
10:39:43,319 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 31) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) 
10:39:43,355 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = h2 
10:39:43,646 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) JBAS017527: Creating file handler for path C:\WildFly8\wildfly-8.0.0.Final/welcome-content 
10:39:43,707 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017525: Started server default-server. 
10:39:43,715 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017531: Host default-host starting 
10:39:43,874 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) JBAS017519: Undertow HTTP listener default listening on /127.0.0.1:8080 
10:39:44,130 WARN [org.jboss.as.messaging] (MSC service thread 1-4) JBAS011600: AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal 
10:39:44,377 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) JBAS015012: Started FileSystemDeploymentService for directory C:\WildFly8\wildfly-8.0.0.Final\standalone\deployments 
10:39:44,581 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221000: live server is starting with configuration HornetQ Configuration (clustered=false,backup=false,sharedStore=true,journalDirectory=C:\WildFly8\wildfly-8.0.0.Final\standalone\data\messagingjournal,bindingsDirectory=C:\WildFly8\wildfly-8.0.0.Final\standalone\data\messagingbindings,largeMessagesDirectory=C:\WildFly8\wildfly-8.0.0.Final\standalone\data\messaginglargemessages,pagingDirectory=C:\WildFly8\wildfly-8.0.0.Final\standalone\data\messagingpaging) 
10:39:44,582 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221006: Waiting to obtain live lock 
10:39:44,729 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221013: Using NIO Journal 
10:39:44,748 WARN [jacorb.codeset] (MSC service thread 1-2) Warning - unknown codeset (Cp1252) - defaulting to ISO-8859-1 
10:39:45,033 INFO [io.netty.util.internal.PlatformDependent] (ServerService Thread Pool -- 58) Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system unstability. 
10:39:45,049 INFO [org.jboss.as.jacorb] (MSC service thread 1-2) JBAS016330: CORBA ORB Service started 
10:39:45,161 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221043: Adding protocol support CORE 
10:39:45,286 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221043: Adding protocol support AMQP 
10:39:45,299 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS] 
10:39:45,305 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221043: Adding protocol support STOMP 
10:39:45,391 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221034: Waiting to obtain live lock 
10:39:45,392 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221035: Live Server Obtained live lock 
10:39:45,472 INFO [org.jboss.as.jacorb] (MSC service thread 1-3) JBAS016328: CORBA Naming Service started 
10:39:45,890 INFO [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final 
Connected to server 
10:39:45,958 INFO [org.jboss.messaging] (MSC service thread 1-4) JBAS011615: Registered HTTP upgrade for hornetq-remoting protocol handled by http-acceptor-throughput acceptor 
10:39:45,961 INFO [org.jboss.messaging] (MSC service thread 1-1) JBAS011615: Registered HTTP upgrade for hornetq-remoting protocol handled by http-acceptor acceptor 
10:39:46,254 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221007: Server is now live 
10:39:46,254 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221001: HornetQ Server version 2.4.1.Final (Fast Hornet, 124) [c42f74fe-ddcf-11e3-9d67-07b9140cdda2] 
10:39:46,272 INFO [org.hornetq.core.server] (ServerService Thread Pool -- 58) HQ221003: trying to deploy queue jms.queue.testQueue 
10:39:46,278 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 58) JBAS011601: Bound messaging object to jndi name queue/test 
10:39:46,279 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 58) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/queue/test 
10:39:46,300 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 60) JBAS011601: Bound messaging object to jndi name java:/ConnectionFactory 
10:39:46,301 INFO [org.jboss.as.messaging] (ServerService Thread Pool -- 59) JBAS011601: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory 
10:39:46,424 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-2) JBAS010406: Registered connection factory java:/JmsXA 
10:39:46,515 INFO [org.hornetq.ra] (MSC service thread 1-2) HornetQ resource adaptor started 
10:39:46,516 INFO [org.jboss.as.connector.services.resourceadapters.ResourceAdapterActivatorService$ResourceAdapterActivator] (MSC service thread 1-2) IJ020002: Deployed: file://RaActivatorhornetq-ra 
10:39:46,518 INFO [org.jboss.as.connector.deployment] (MSC service thread 1-2) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA] 
10:39:46,518 INFO [org.jboss.as.messaging] (MSC service thread 1-8) JBAS011601: Bound messaging object to jndi name java:jboss/DefaultJMSConnectionFactory 
10:39:46,636 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management 
10:39:46,637 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990 
10:39:46,637 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.0.0.Final "WildFly" started in 12523ms - Started 216 of 264 services (90 services are lazy, passive or on-demand) 
10:40:35,457 INFO [org.jboss.ejb.client] (XNIO-1 task-3) JBoss EJB Client version 2.0.0.Final 

當我開始在Java程序中,我得到以下錯誤:

May 22, 2014 10:57:29 AM org.xnio.Xnio <clinit> 
INFO: XNIO version 3.2.0.Final 
May 22, 2014 10:57:29 AM org.xnio.nio.NioXnio <clinit> 
INFO: XNIO NIO Implementation Version 3.2.0.Final 
May 22, 2014 10:57:30 AM org.jboss.remoting3.EndpointImpl <clinit> 
INFO: JBoss Remoting version (unknown) 
May 22, 2014 10:57:30 AM HelloWorldJMSClient main 
INFO: Attempting to acquire connection factory "jms/RemoteConnectionFactory" 
May 22, 2014 10:57:35 AM HelloWorldJMSClient main 
SEVERE: Failed to connect to any server. Servers tried: [http-remoting://127.0.0.1:8080  
(Operation failed with status WAITING after 5000 MILLISECONDS)] 

當我運行它在調試器下,我可以看到該程序獲取initial JNDI context,然後在第一個lookup上失敗。

所以看起來期待//127.0.0.1:8080服務器的程序沒有看到服務器運行在這個非常URL上。

我嘗試將網址更改爲//localhost:8080,但沒有任何區別。

這是很有可能的,我有一個愚蠢的錯字,我根本無法注意到的地方。

無論如何,我該如何進一步排除這種情況?

澄清(0523/14):

當我打開我的瀏覽器localhost:8080我得到WildFly的歡迎頁面。然後我可以進入管理小組。這是如何獲得前兩個JNDI/JMS相關的屏幕截圖。

netstat與服務器上運行:

TCP 127.0.0.1:8080   0.0.0.0:0    LISTENING 

這結果是一樣的我是否在命令行或IntellJ IDEA啓動服務器。

網絡流量

我相信這是一個有關部分:

enter image description here

Link to a better view.

UPDATE(2014年5月28日)

因爲它被指向我Wildfly's Forum從日誌以下行(我有點懷疑)應該已經舉着紅旗:

May 22, 2014 10:57:30 AM org.jboss.remoting3.EndpointImpl
INFO: JBoss Remoting version (unknown)

我用下面的罐子手動另外一個信息位(不知道它是否是相關的)解決依賴關係:

enter image description here

+1

檢查的使用netstat的東西實際上在聽在本地主機上:8080。看看你的野蠻日誌fr任何相關的消息。檢查端口是否打開。 – Iain

+0

@Iain - 事實是,當我在瀏覽器中打開'licalhost:8080'時,它帶出了WildFly的歡迎頁面,足以證明服務器實際上在此端口上處於活動狀態? –

+0

@ PM77-1是的。提到在你的q。 –

回答

4

同意@Iain。 netstat -nab將列出所有端口及其擁有者進程。如果127.0.0.1:8080或0.0.0.0:8080被列爲LISTENING,我可能會啓動Wireshark並嗅探8080 tcp以確保您的嗅覺過程實際上正在迴應。這聽起來像你正在尋找基本的東西,wireshark將主要爲你解碼。

不言而喻,這不應該在您的生產部署/ /對抗您的生產部署完成,除非絕對一切都被打破,事情需要修復現在。解決問題後,您需要查看您的測試和升級程序。

要檢查的TCP/HTTP連接設置診斷:

  1. 服務器不恨只是你的客戶。使用備用機器和已知的工作客戶機(或有點類似的客戶機)連接到服務器。類似的客戶端可以是瀏覽器,也可以是netcat/telnet。如果這樣做,你的客戶端壞了,或者你的服務器明確拒絕你的客戶端測試。
  2. 服務器正在偵聽。贏得:netstat -nab,許多* nix:netstat -nlp。爲您的服務器進程尋找IP:Port LISTENING行。也許別的東西已經竊取了你的監聽端口,或者它在TIMEWAIT中,因爲你的崩潰服務器從未關閉它。
  3. 服務器正在接收傳入的連接請求。在服務器端,windows:wireshark,nix:wireshark/tcpdump -i <interface> 'port <listenport>'。在偵聽端口和服務器回覆中查找來自客戶端的傳入SYN數據包。沒有傳入的數據包意味着被網絡配置或防火牆等阻塞,這使得它成爲網絡調試問題。沒有傳出數據包通常意味着服務器損壞或配置錯誤。
  4. 客戶端收到服務器的響應。在確認服務器正在完成tcp連接但沒有來自客戶端的http命令之後,驗證客戶端計算機是否使用大致相同的過程來接收數據包。如果它沒有收到服務器發送的數據包,這是一個網絡調試問題。如果是這樣,那麼你的客戶就壞了。
  5. 服務器完成協議響應。客戶端發送完整請求,如「GET/HTTP/1.1 \ r \ n \ r \ n」,服務器回覆「HTTP/1.1 200 OK」。
    • 服務器可能會回覆一些握手二進制文件,而不是您的客戶端期望它,例如,如果您忘記客戶端上的SSL;這是一個很常見的錯誤。 SSL協議解碼通常包括將客戶端或服務器上的密鑰轉儲出來並將其複製到wireshark中 - 此時,我通常會啓動gdb/jdb/dtrace並在進入ssl寫入之前以及從ssl讀取返回之後轉儲出字符串。這是有效的,因爲連接已經建立並且可靠,所以除非它做了有趣的事情並且死去,離開網絡分析並開始定期調試程序。

簡單的事情,當你難倒或者你已經花了一個小時,沒有任何進展嘗試:

  1. 你閱讀手冊?遲到總比不到好。
  2. 更改服務器偵聽端口。在10k-12k範圍內的東西不可能與任何東西相沖突。
  3. 將客戶端和服務器可調整線程/進程降至最低,以重現錯誤。如果錯誤消失,你會找到一些東西。如果沒有,那麼在調試器中有更少的線程上下文進行切換時,調試會更容易。
  4. 獲得支持合同?詢問供應商。描述你所做的診斷,通常在失敗之前跳過那些工作直到一到兩次的東西,然後給他們一些背景。就像問一個Stackexchange問​​題一樣,只有你付錢。如果他們沒有提供及時的支持,請檢查是否有相同價位的更好選擇並重新評估您的業務需求;與現在運行的蹩腳軟件相比,你無法上手的一大部分軟件的用處和價值都小得多。
+0

非常感謝您的詳細解答。這根本不是刺激。一切都在我的開發筆記本上。真正讓我感到惱火的是,它對許多其他人遵循了看似相同的指示。 'WildFly'是'JBoss Community Edition'重新命名的名稱,它是免費的。 –

+0

@ PM77-1我不是故意叫你出來,我可以告訴你。它不是刺激,但我通常在我的答案中有一個像SOP那樣的免責聲明。因爲有些人...... –

+0

'Wireshark'對'localhost'不友好。我下載了'RawCap',現在我可以在'WireShark'中看到它的結果。有沒有更好的辦法?產量很大。我應該過濾掉HTTP流量嗎? –

0

變化Wildfly管理控制檯中的JNDI名稱這些:

JMS/RemoteConnectionFactory(用於連接工廠) JMS /隊列/測試(隊列)

相關問題