我大家,
我正在尝试将我们的MQ接口从IBM-Websphere 7.0.0.5迁移到版本8.0.0.6。作为EJB容器,我们使用的是Apache Servicemix 7.0.0。切换到8.0.0.6库时,我会收到以下错误堆栈:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ibmmq' defined in URL [bundle://231.0:0/META-INF/spring/mq-test.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.ibm.mq.jms.MQQueueConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.ibm.mq.jms.MQQueueConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:636)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:938)[150:org.apache.servicemix.bundles.spring-context:3.2.17.RELEASE_1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[217:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[217:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[217:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[217:org.springframework.osgi.core:1.2.1]
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[218:org.springframework.osgi.extender:1.2.1]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_102]
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.ibm.mq.jms.MQQueueConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.ibm.mq.jms.MQQueueConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:464)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:495)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:489)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1465)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1424)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1160)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
... 13 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [com.ibm.mq.jms.MQQueueConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:267)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:449)[149:org.apache.servicemix.bundles.spring-beans:3.2.17.RELEASE_1]
... 19 more
以下行对我来说很奇怪,我没有结论:
无法将'com.ibm.mq.jms.mqqueeconnectionfactory'类型的属性值转换为所需类型的'javax.jms.connectionfactory'for属性'connection'connection factory';嵌套异常是java.lang.illegalstateException:无法转换类型的值[com.ibm.mq.jms.jms.mqqueeeconnectionfactory],以属性'ConnectionFactory'的必需类型[javax.jms.connectionfactory]:无匹配的编辑或转换策略,P>
要安装功能,我使用了以下功能-XML文件:
<features xmlns="http://karaf.apache.org/xmlns/features/v1.0.0">
<feature name='ibm-mq-75' version='7.5.0.0'>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 75/java/lib/OSGi/com.ibm.mq.osgi.directip_7.5.0.0.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 75/java/lib/OSGi/com.ibm.mq.osgi.java_7.5.0.0.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 75/java/lib/OSGi/com.ibm.msg.client.osgi.commonservices.j2se_7.5.0.0.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 75/java/lib/OSGi/com.ibm.msg.client.osgi.jms_7.5.0.0.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 75/java/lib/OSGi/com.ibm.msg.client.osgi.nls_7.5.0.0.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 75/java/lib/OSGi/com.ibm.msg.client.osgi.wmq.nls_7.5.0.0.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 75/java/lib/OSGi/com.ibm.msg.client.osgi.wmq.prereq_7.5.0.0.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 75/java/lib/OSGi/com.ibm.msg.client.osgi.wmq_7.5.0.0.jar</bundle>
</feature>
<feature name='ibm-mq-80' version='8.0.0.6'>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 80/java/lib/OSGi/com.ibm.mq.osgi.java_8.0.0.6.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 80/java/lib/OSGi/com.ibm.msg.client.osgi.commonservices.j2se_8.0.0.6.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 80/java/lib/OSGi/com.ibm.msg.client.osgi.jms.prereq_8.0.0.6.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 80/java/lib/OSGi/com.ibm.msg.client.osgi.jms_8.0.0.6.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 80/java/lib/OSGi/com.ibm.msg.client.osgi.nls_8.0.0.6.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 80/java/lib/OSGi/com.ibm.msg.client.osgi.wmq.nls_8.0.0.6.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 80/java/lib/OSGi/com.ibm.msg.client.osgi.wmq.prereq_8.0.0.6.jar</bundle>
<bundle start-level='85'>file:o:/tools/IBM/Websphere MQ 80/java/lib/OSGi/com.ibm.msg.client.osgi.wmq_8.0.0.6.jar</bundle>
</feature>
</features>
示例路线看起来如下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util" xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd http://www.springframework.org/schema/osgi-compendium http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">
<!--bean id="conFactoryFactory" class="com.ibm.mq.jms.MQConnectionFactoryFactory" /-->
<bean id="conFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory" >
<property name="transportType">
<util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP" />
</property>
<property name="hostName" value="gs3-mqsrv-lnx" />
<property name="port" value="1414" />
<property name="queueManager" value="qm.gb30.realtime" />
<property name="channel" value="ch.realtime" />
<property name="useConnectionPooling" value="true" />
</bean>
<bean id="ibmmq" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="conFactory" />
</bean>
<camel:camelContext id="ibm-mq-test">
<!-- Uplink from file -> mq -->
<camel:route id="mq-uplink">
<camel:from uri="file:mq/in" />
<camel:transacted />
<camel:to uri="ibmmq:lq.gslisa.src1" />
<camel:log message="Put message into mq!" />
</camel:route>
<!-- Downlink from mq -> file -->
<camel:route id="mq-downlink">
<camel:from uri="ibmmq:lq.gslisa.src1" />
<camel:transacted />
<camel:to uri="file:mq/out" />
<camel:log message="Read message from mq!" />
</camel:route>
</camel:camelContext>
</beans>
如前所述,使用功能: ibm-mq-75 一切都在阻塞,将其更改为 IBM-MQ-80 显示错误。有人可以帮忙吗?
谢谢Jörg
执行以下步骤似乎解决了我的问题:
- 将MQ包装从Camel-JMS切换到Camel-SJMS
- 强迫ServiceMix清洁每个启动时的高速缓存。