【发布时间】:2013-03-10 21:55:01
【问题描述】:
我正在尝试连接到 Websphere app Server 7.0 中定义的 MQ 连接工厂。
但我找不到合适的连接工厂接口供 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>
代码不工作
<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>
其中 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 org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
Caused by: java.lang.IllegalArgumentException: [com.ibm.mq.jms.MQQueueConnectionFactoryFactory] is not an interface
我需要帮助来用正确的代码替换不工作的代码。 春天 - 3.0.5 IBM MQ 和 Web 应用服务器 - 7.0
【问题讨论】: