2013-11-14 92 views
0

我正在嘗試使用worklight jms adpater和Websphere MQ Provider。 步驟如下: 在WMQ V7.0 Explorer中,右鍵單擊JMS管理對象 - >添加初始上下文 - >選擇 文件系統 - >在綁定目錄(C:/ JNDI_Directory)中給出名稱 - >給出 上下文暱稱(文件:/ C:/ JNDI_Directory /),然後單擊完成。Worklight JMS適配器問題

In connectionFactory, the context nickname will be set as file:/C:/JNDI_Directory/ -> then click on New -> Gave connection factory name (JMSConnectionFactory) 
and select messaging provider as, Websphere MQ -> select the connection factory -> select transport as MQ Client -> 
Select base queue manager(JMS_QMGR) and connection list(localhost(2525)) in the connection tab. 

In Destination -> new -> Destination -> enter the name of destination(JMSDestination) and type of queue -> select Queue Manager and queue in general tab 

In Worklight creating worklight project name as TestJMSAdapter and created a jms adapter(JMSAdapter), configured the following in JMSAdapter.xml file. 


<namingConnection url="file:/C:/JNDI_Directory/" initialContextFactory="com.sun.jndi.fscontext.RefFSContextFactory"/> 

<jmsConnection connectionFactory="JMSConnectionFactory" /> 

In JMSAdapter-impl.js, configure the destination as follows, 
readMessage(){ 
      return WL.Server.readSingleJMSMessage({ 
             destination: "JMSDestination", 
             timeout: 60 
             }); 
        } 

,並帶走了所有罐子從/的WebSphere MQ/JAVA/lib下,加入lib文件夾下面的罐子:

/TestJMSAdapter/server/lib/com.ibm.mq.commonservices.jar 
/TestJMSAdapter/server/lib/com.ibm.mq.headers.jar 
/TestJMSAdapter/server/lib/com.ibm.mq.jar 
/TestJMSAdapter/server/lib/com.ibm.mq.jmqi.jar 
/TestJMSAdapter/server/lib/com.ibm.mq.jms.Nojndi.jar 
/TestJMSAdapter/server/lib/com.ibm.mqjms.jar 
/TestJMSAdapter/server/lib/dhbcore.jar 
/TestJMSAdapter/server/lib/fscontext.jar 
/TestJMSAdapter/server/lib/jms.jar 
/TestJMSAdapter/server/lib/jndi.jar 
/TestJMSAdapter/server/lib/providerutil.jar 

我使用工作燈V6和部署在(WebSphere Application Server的V8。 5 Liberty)Worklight Development Server。

在調用它顯示了以下錯誤的程序:

錯誤工作燈開發服務器控制檯,

[ERROR ] FWLSE0005W: JMS connection exception received: com.ibm.mq.jms.MQConnectionFactory cannot be cast to javax.jms.ConnectionFactory. Closing the connection. [project TestJMSAdapter] 

請幫助我。

+0

以下是一些調試步驟。 A.查看/errors和/Qmgrs/ /錯誤中的MQ錯誤日誌,並觀察是否有任何與之相關的錯誤 B.檢查應用程序服務器日誌(如果需要,打開跟蹤) 。大多數情況下,您會發現一個異常及其堆棧跟蹤,它將指出錯誤/故障的原因。 我注意到你的MQ監聽器端口不是默認的(2525)。您是否確保該端口上的偵聽器正在運行,並且連接工廠是否有正確的信息。 – Srik

回答

0

您看到的錯誤通常是由於您的項目中添加了不正確的罐子引起的。

你有兩個選擇:

  • 找出哪個罐子需要刪除。

我相信造成你的問題的jar是「jms.jar」文件。刪除該文件並重試。

  • 升級到最新版本的Worklight。

所有類加載問題已在最新版本的worklight中修復,因此無論包含哪個jar都應該可以工作。

+0

我已經刪除了「jms.jar」,現在我得到了「[錯誤] FWLSE0006E:收到不支持類型的JMS消息:null。消息被忽略。[project TestJMSAdapter]」錯誤。我正在使用更新的版本。 - IBM Worklight Server V6.0.0 - 在eclipse juno中包含的IBM Worklight Studio V6.0.0.201306140701插件(4.2.2)現在該如何處理? –

+1

好極了,現在你的適配器正在工作,你正在接收來自你後端的消息。目前,Worklight適配器僅支持TextMessage數據類型。它看起來像你的後端發送一個不同類型的消息。消息「unsupported type:null」似乎是一個將被記錄的缺陷,因爲它應該顯示正在發送的消息的數據類型。嘗試檢查發送哪種類型的消息,並查看是否有可能使其成爲短信。 – jnortey

+0

另外,如果您認爲JMS適配器應該支持其他數據類型,則可以提交功能請求以添加此功能。 – jnortey