【问题标题】:Apache ServiceMix connection to IBM-Websphere-8.0Apache ServiceMix 与 IBM-Websphere-8.0 的连接
【发布时间】:2017-09-24 22:42:13
【问题描述】:

各位,

我正在尝试将我们的 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.MQQueueConnectionFactory”的属性值转换为属性“connectionFactory”所需的类型“javax.jms.ConnectionFactory”;嵌套异常是 java.lang.IllegalStateException:无法将类型 [com.ibm.mq.jms.MQQueueConnectionFactory] ​​的值转换为属性“connectionFactory”所需的类型 [javax.jms.ConnectionFactory]:找不到匹配的编辑器或转换策略

为了安装这些功能,我使用了以下 features-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 会显示错误。 有人可以帮忙吗?

谢谢, 约尔格

【问题讨论】:

  • 看来,问题是由混合 JMS 版本引起的:ServiceMix 使用 JMS 1.1 和 geronimo-specification- 1.1.1 IBM-MQ lib 使用库中提供/导出的 JMS 2.0:com .ibm.msg.client.osgi.jms.prereq_8.0.0.6.jar 在不使用 ASM 的情况下构建蓝图测试用例按预期工作。那么如何告诉接口包使用 IBM-jms 版本呢?

标签: ibm-mq apache-servicemix


【解决方案1】:

执行以下步骤似乎可以解决我的问题:

  1. 将 mq-package 从 camel-jms 切换到 camel-sjms
  2. 强制 servicemix 在每次启动时清理缓存。

【讨论】:

    猜你喜欢
    • 2012-03-08
    • 1970-01-01
    • 2011-10-19
    • 1970-01-01
    • 2012-12-02
    • 1970-01-01
    • 2021-08-01
    • 2016-03-13
    • 1970-01-01
    相关资源
    最近更新 更多