0

我正在尝试将 worklight jms adpater 与 Websphere MQ Provider 一起使用。步骤:在 WMQ V7.0 Explorer 中,右键单击 JMS Administered Objects -> Add Inital Context -> 选择 File System -> Gave name in Bindings directory (C:/JNDI_Directory) -> Gave Contextnickname(file:/C: /JNDI_Directory/) 并单击完成。

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 中取出所有 jar,在 lib 文件夹中添加以下 jar:

/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

我正在使用 worklight v6 并部署在(WebSphere Application Server V8.5 Liberty)Worklight Development Server 中。

在调用该过程时,它显示以下错误:

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]

请帮帮我。

4

1 回答 1

0

您看到的错误通常是由于将不正确的 jar 添加到您的项目中造成的。

你有两个选择:

  • 找出需要移除的罐子。

我相信导致您的问题的 jar 是“jms.jar”文件。删除该文件并重试。

  • 升级到最新版本的 Worklight。

所有类加载问题都已在最新版本的 worklight 中得到修复,因此无论包含哪些 jar,它都应该仍然可以工作。

于 2013-11-14T14:51:05.350 回答