小编Aru*_*her的帖子

如何从Spring中定义在Websphere app Server中定义的MQ连接工厂的jndi查找

我正在尝试连接到Websphere app Server 7.0中定义的MQ连接工厂.

但我找不到一个正确的connectionfactory接口供MQ在Spring中定义.

但是当我尝试在spring配置文件中硬编码连接细节时,我能够连接到队列管理器.

在Spring bean中使用什么正确的接口/格式来加载在Websphere appl服务器中定义的MQ连接工厂?

工作守则

<bean id="mqConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="hostName">
        <value>127.0.0.1</value>
    </property>
    <property name="port">
        <value>1414</value>
    </property>
    <property name="queueManager">
        <value>MYQM</value>
    </property>
    <property name="transportType">
        <value>1</value>
    </property>
</bean>
Run Code Online (Sandbox Code Playgroud)

不工作的代码

<bean id="mqConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jms/WASQM"/>
    <property name="lookupOnStartup" value="false"/>
    <property name="cache" value="true" />
    <property name="proxyInterface"  value="com.ibm.mq.jms.MQQueueConnectionFactoryFactory" />
</bean>
Run Code Online (Sandbox Code Playgroud)

其中WASQM是Websphere中定义的MQ连接工厂

非工作代码出错

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mqConnectionFactory' defined in ServletContext resource [/WEB-INF/config/config-mq.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: [com.ibm.mq.jms.MQQueueConnectionFactoryFactory] is not an interface
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
at …
Run Code Online (Sandbox Code Playgroud)

lookup spring jndi ibm-mq

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

ibm-mq ×1

jndi ×1

lookup ×1

spring ×1