We set our properties like this. So MQQueueConnectionFactory uses CCDT(You can 
continue with the same properties you have.)
Then we do caching of that connection to increase performance. And Main is your 
JMSComponent as that's what is used for making connection to IBM MQ.

<!-- Queue Manager Connection factory(s) -->
  <bean id="wmqConnectionFactory1-Prod1" 
class="com.ibm.mq.jms.MQQueueConnectionFactory">
    <property name="CCDTURL">
      <bean class="com.tgt.tcom.il.financial.MQConnectionFactoryUtil" 
factory-method="convert">
        <argument value="${financial.WMQ.CCDTfile}" />
      </bean>
    </property>
    <property name="queueManager" value="${financial.WMQ.QMGrpName1}" />

  </bean>
  <!-- Cache Connection Factory -->

  <bean id="cachingWmqConnectionFactory1-Prod1"
                
class="org.springframework.jms.connection.CachingConnectionFactory"
                destroy-method="destroy">
    <property name="targetConnectionFactory" ref="wmqConnectionFactory1-Prod1" 
/>
    <property name="cacheConsumers" value="true" />
    <property name="reconnectOnException" value="true" />
    <property name="sessionCacheSize" value="10" />
  </bean>

  <!--Spring Transaction Manager -->

  <bean id="wmqTransactionManager1-Prod1"
                
class="org.springframework.jms.connection.JmsTransactionManager">
    <property name="connectionFactory" ref="wmqConnectionFactory1-Prod1" />
  </bean>

  <!--JMS components used for Endpoints -->
  <bean id="wmq-qmSub1-Prod1" 
class="org.apache.camel.component.jms.JmsComponent">
    <property name="connectionFactory" ref="cachingWmqConnectionFactory1-Prod1" 
/>
    <property name="transactionManager" ref="wmqTransactionManager1-Prod1" />
    <property name="transacted" value="false" />
    <property name="cacheLevelName" value="CACHE_AUTO" />
    <property name="concurrentConsumers" 
value="${financial.WMQ.DWSub1.Consumers}" />
    <property name="maxConcurrentConsumers" 
value="${financial.WMQ.DWSub1.MaxConsumers}" />
    <property name="maxMessagesPerTask" 
value="${financial.WMQ.DWSub1.maxMessagesPerTask}" />
  </bean>

Thanks and Regards,

Vanshul Chawla


-----Original Message-----
From: VijaySathya [mailto:[email protected]] 
Sent: Wednesday, July 29, 2015 3:37 AM
To: [email protected]
Subject: MQConnectionFactory Error

I get the following error when my server starts ( and tries to initialize the 
spring beans - I have a main camel context spring based config file, which 
imports 3 other spring config files. In one of the files, I define JMS beans 
including Connection Factories. That is where I am having issues.):

I get the following error: 

Initialization of bean failed; nested exception is
org.springframework.beans.ConversionNotSupportedException: Failed to convert 
property value of type 'com.ibm.mq.jms.MQConnectionFactory' to required type 
'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested 
exception is java.lang.IllegalStateException: Cannot convert value of type 
[com.ibm.mq.jms.MQConnectionFactory] to required type 
[javax.jms.ConnectionFactory] for property 'connectionFactory': no matching 
editors or conversion strategy found


Will appreciate any help to resolve this. Thanks.

More Details:
=========


I have a Camel based solution deployed as a war file in tomcat.

My context file has a route that listens to a IBM Websphere JMS Queue and 
routes  the message (SOAP over JMS) to a SOAP web service on a destination 
server.

The  camel context fragment is as below:

<?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:context="http://www.springframework.org/schema/context";
    xmlns:amq="http://activemq.apache.org/schema/core";
xmlns:camel="http://camel.apache.org/schema/spring";
    xmlns:p="http://www.springframework.org/schema/p";
    xsi:schemaLocation="
       http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
       http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
    ">
        <import resource="spring-bean-router-components.xml"/>
        <import resource="spring-bean-common-translators.xml" />
        <import resource="spring-context-jms-resources.xml" />
        


        
        <camelContext  
                                        
xmlns="http://camel.apache.org/schema/spring"; 
                                        
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
                                                                                
        >
        
                 <propertyPlaceholder id="properties"
location="file:${env:ASB_HOME}/asb-configuration.properties"/>
            
            
              <errorHandler id="asbDefaultEH" type="DefaultErrorHandler" >
                <redeliveryPolicy maximumRedeliveries="2" redeliveryDelay="1000"
                        retryAttemptedLogLevel="WARN"/>
                
              </errorHandler>
              
              
              <errorHandler id="asbDLQErrorHandler" type="DeadLetterChannel"
              deadLetterUri="direct:asbDLC" useOriginalMessage="true"/>
              
                        

            

            
            <route id="jmsRouteForMQ">
            <from uri="wmq:queue:testQueue?preserveMessageQos=true" />
             <to uri="direct:processJmsToSoap"/>        
        </route>
        
             <route id="routeJmsToSoap" errorHandlerRef="asbDLQErrorHandler">
                    <from uri="direct:processJmsToSoap"/>                   
                   
                    <log message="Route message from in queue to out queue with 
data ${body}" />
             
                <setHeader headerName="sender">
                        <simple>${headers[sender]}</simple>        
                        </setHeader>
                        <log message="Sender is=  ${header.sender} reply to= 
${headers[JMSReplyTo]} "/>
                        <setHeader headerName="httpPath">
                        <simple>${headers[webContext]}</simple>        
                        </setHeader>
                        <setHeader headerName="serviceEndPoint">
                        <simple>${headers[serviceEndPoint]}</simple>        
                        </setHeader>
                        
            <process ref="jMSTextMessageToSoapMessageConverterProcessor" />
            <setHeader headerName="serviceName">
                          <xpath resultType="java.lang.String">
                            local-name(//soapenv:Body/*[1])
                          </xpath>
                        </setHeader>
                        
                        
                        
            
            
            <process ref="jmsToSoapUriSelectorProcessor"/>
            
            
           
           
            
 
            <log message="Invoking recipient list with header value:
${header.serviceUri}"/> 
             
            <recipientList ignoreInvalidEndpoints="true">
                        <header>serviceUri</header>
                </recipientList>
                
                
           
                <process ref="webServiceResponseProcessor"/>
                <wireTap uri="direct:responseTap"/>  
                
                        
                </route>
            
            
            <route>
                  <from uri="direct:asbDLC"/>
                  <log logName="CamelDLCErrorNotifications" loggingLevel="ERROR"
                            message="Exception from notification Camel route - 
Message Failed due to errors- Did not process" />
                  
                  <process ref="deadLetterPreProcessor"/>
                  <to uri="jms:queue:deadLetters"/>
                </route>
            
            
            

                
                

  </camelContext>
  
</beans>

The imported spring-context-jms-resources.xml file has the following fragment 
in it's definition:

        <bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
          <property name="connectionFactory" ref ="wmqCf">
           
          </property>
        </bean>
        
        <bean id="wmqCf" class="com.ibm.mq.jms.MQConnectionFactory">
                <property name="queueManager" value="XKOBIE_QMDEV01" />
                <property name="hostName" value="STPDQBBY01" />
                <property name="port" value="1414" />
                <property name="channel" value="JAVA.DEF.SVRCONN" />
                
                <property name="transportType" value="1"/>
        </bean>

I use maven to build and I build my war successfully and deploy to tomcat.

when I start tomcat, i get the following error:

org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'wmq' defined in class path resource
[spring-context-jms-resources.xml]: Initialization of bean failed; nested 
exception is org.springframework.beans.ConversionNotSupportedException:
Failed to convert property value of type 'com.ibm.mq.jms.MQConnectionFactory' 
to required type 'javax.jms.ConnectionFactory' for property 
'connectionFactory'; nested exception is java.lang.IllegalStateException: 
Cannot convert value of type [com.ibm.mq.jms.MQConnectionFactory] 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:547)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
        at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
        at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
        at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
        at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
        at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
        at
org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
        at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
        at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
        at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4729)
        at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5167)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
        at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to 
convert property value of type 'com.ibm.mq.jms.MQConnectionFactory' to required 
type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested 
exception is java.lang.IllegalStateException:
Cannot convert value of type [com.ibm.mq.jms.MQConnectionFactory] to required 
type [javax.jms.ConnectionFactory] for property
'connectionFactory': no matching editors or conversion strategy found
        at
org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:476)
        at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:512)
        at
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:506)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1523)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1482)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1222)
        at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
        ... 20 more









--
View this message in context: 
http://camel.465427.n5.nabble.com/MQConnectionFactory-Error-tp5770036.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to