【发布时间】:2014-05-29 22:37:59
【问题描述】:
我正在尝试在 spring/camel 中为 Websphere MQ 配置 JMS 连接池。当我尝试从 spring 中使用 CachingConnectionFactory 时,我看到了类转换异常。无法从 WMQ 中找到池,有没有人使用 WMQ 完成连接池,我没有找到任何示例。 ActiveMQ 有很多例子。
这是我目前所拥有的,即产生类强制转换异常。
<bean id="inCachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory">
<property name="targetConnectionFactory" ref="inboundMqConnectionFactory1" />
<property name="sessionCacheSize" value="5" />
</bean>
<bean id="inboundWebsphereMq1" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="inCachingConnectionFactory" />
<property name="destinationResolver" ref="jmsDestinationResolver" />
<property name="transacted" value="true" />
<property name="transactionManager" ref="txManager1" />
</bean>
<bean id="inboundMqConnectionFactory1" class="com.ibm.mq.jms.MQQueueConnectionFactory">
<property name="hostName" value="${isi.inbound.queue.host2}" />
<property name="port" value="${isi.inbound.queue.port}" />
<property name="queueManager" value="${isi.inbound.queue.queuemanager2}" />
<property name="channel" value="${isi.inbound.queue.channel2}" />
<property name="transportType" value="${isi.queue.transportType}" />
</bean>
我看到的异常在这里
试图恢复。原因:com.sun.proxy.$Proxy37 无法转换为 com.ibm.mq.jms.MQQueueSession
【问题讨论】:
-
这个帖子说已经取消了pooling支持,不知道为什么。 stackoverflow.com/questions/8922339/…
-
是的。你需要实现你自己的。检查此技术说明。 www-01.ibm.com/support/docview.wss?uid=swg21665128
-
您好 nsupathy 感谢您的指点,这帮助我理解了原因。能否指点一下我自己使用spring配置的方法?
-
我解决了我的类转换问题,它在我的 DestinationResolver 中转换它,但是使用缓存池它正在获取代理。我更新了目标解析器中的代码并创建了池。
标签: spring connection-pooling ibm-mq