title: Error initializing caching connectionfactory in tomcat 7.0
body: <p>i have found some similar tasks but none of them seems to fix my problem. I have a spring-application and deploy this application into a maven-jetty-plugin. All works fine... jetty comes up without errors, integrationtests are green. Next i wanted to get my app running in tomcat 7.0 but i get an exception and i'm not able to fix it. May be anybody has an idea. Thanks a lot in advance.</p>
  
  <p>Please be aware, that it is my first app that i deploy into tomcat, so may be i did some very basic mistakes...</p>
  
  <p>Here the exception:</p>
  
  
  
  <pre><code>2015-11-15 20:30:14,371 | ERROR | localhost-startStop-1 | o.s.w.c.ContextLoader | Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cachingConnectionFactory' defined in class path resource [spring-jms.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.apache.activemq.ActiveMQConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'targetConnectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.activemq.ActiveMQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'targetConnectionFactory': no matching editors or conversion strategy found
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) ~[spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5003) [catalina.jar:7.0.64]
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5517) [catalina.jar:7.0.64]
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.64]
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.64]
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.64]
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652) [catalina.jar:7.0.64]
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1095) [catalina.jar:7.0.64]
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1930) [catalina.jar:7.0.64]
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_25]
      at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_25]
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_25]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_25]
      at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
  Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.apache.activemq.ActiveMQConnectionFactory' to required type 'javax.jms.ConnectionFactory' for property 'targetConnectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.activemq.ActiveMQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'targetConnectionFactory': no matching editors or conversion strategy found
      at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:476) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:512) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:506) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1523) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1482) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1222) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 24 common frames omitted
  Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.apache.activemq.ActiveMQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'targetConnectionFactory': no matching editors or conversion strategy found
      at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:287) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:461) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 30 common frames omitted
  </code></pre>
  
  
  
  <p>Here is the spring-jms.xml:</p>
  
  
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jms="http://www.springframework.org/schema/jms"
      xmlns:amq="http://activemq.apache.org/schema/core"
      xsi:schemaLocation="
          http://www.springframework.org/schema/beans 
          http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
          http://www.springframework.org/schema/jms 
          http://www.springframework.org/schema/jms/spring-jms.xsd
          http://activemq.apache.org/schema/core 
          http://activemq.apache.org/schema/core/activemq-core.xsd"
      default-autowire="byName"&gt;
  
      &lt;!-- START JMS Config --&gt;
  
      &lt;jms:annotation-driven/&gt;
  
      &lt;!-- Possible productive configuration --&gt;
  
  
      &lt;amq:broker id="broker" useJmx="false" persistent="false" &gt;
          &lt;amq:transportConnectors&gt;
              &lt;amq:transportConnector uri="tcp://localhost:61616"/&gt;
          &lt;/amq:transportConnectors&gt;
      &lt;/amq:broker&gt;
  
      &lt;bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"&gt; 
          &lt;!-- all config for embedded url see http://activemq.apache.org/broker-uri.html --&gt;
          &lt;!-- &lt;property name="brokerURL" value="vm://embedded?broker.persistent=false"/&gt;--&gt;
  &lt;!--        &lt;property name="brokerURL" value="vm://localhost?broker.persistent=false"/&gt; --&gt;
          &lt;property name="brokerURL" value="tcp://localhost:61616"/&gt;
      &lt;/bean&gt; 
  
  
  
      &lt;bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"&gt;
          &lt;property name="targetConnectionFactory" ref="connectionFactory"/&gt;
      &lt;/bean&gt; 
  
      &lt;bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
          &lt;property name="connectionFactory" ref="cachingConnectionFactory"/&gt;
          &lt;property name="sessionTransacted" value="true" /&gt;
      &lt;/bean&gt;
  
      &lt;bean id = "destinationResolver" class = "org.springframework.jms.support.destination.DynamicDestinationResolver"&gt;&lt;/bean&gt;
  
      &lt;bean id="jmsListenerContainerFactory" class="org.springframework.jms.config.DefaultJmsListenerContainerFactory"&gt;
          &lt;property name="connectionFactory" ref="connectionFactory"/&gt;
          &lt;property name="errorHandler" ref="jmsErrorHandler"/&gt;
          &lt;property name="destinationResolver" ref="destinationResolver"/&gt;
          &lt;property name="concurrency" value="1-10"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id = "jmsErrorHandler" class = "com.mleitner.businessmaximizer.service.JMSErrorHandler" /&gt;
  
      &lt;!-- END JMS Config --&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  
  
  <p>Versions:</p>
  
  <ul>
  <li>activemq-all-5.12.0.jar </li>
  <li>spring-core-4.1.6.RELEASE.jar</li>
  <li>spring-context-4.1.6.RELEASE.jar spring-jms-4.1.6.RELEASE.jar</li>
  <li>spring-beans-4.1.6.RELEASE.jar</li>
  <li>Tomcat 7.0</li>
  </ul>
  
  <p>Update: pom.xml jetty-maven-plugin added:</p>
  
  
  
  <pre><code>&lt;plugin&gt;
                  &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
                  &lt;artifactId&gt;jetty-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;9.3.0.RC1&lt;/version&gt;
                  &lt;dependencies&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
                          &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
                          &lt;version&gt;1.1.2&lt;/version&gt;
                      &lt;/dependency&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
                          &lt;artifactId&gt;logback-access&lt;/artifactId&gt;
                          &lt;version&gt;1.1.2&lt;/version&gt;
                      &lt;/dependency&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                          &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
                          &lt;version&gt;1.7.7&lt;/version&gt;
                      &lt;/dependency&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;com.h2database&lt;/groupId&gt;
                          &lt;artifactId&gt;h2&lt;/artifactId&gt;
                          &lt;version&gt;1.4.179&lt;/version&gt;
                      &lt;/dependency&gt;
                      &lt;dependency&gt;
                          &lt;groupId&gt;c3p0&lt;/groupId&gt;
                          &lt;artifactId&gt;c3p0&lt;/artifactId&gt;
                          &lt;version&gt;0.9.1.2&lt;/version&gt;
                      &lt;/dependency&gt; 
                      &lt;dependency&gt;
                          &lt;groupId&gt;org.apache.activemq&lt;/groupId&gt;
                          &lt;artifactId&gt;activemq-core&lt;/artifactId&gt;
                          &lt;version&gt;5.7.0&lt;/version&gt;
                          &lt;exclusions&gt;
                              &lt;exclusion&gt;
                                  &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
                                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                              &lt;/exclusion&gt;
                              &lt;exclusion&gt;
                                  &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
                                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                              &lt;/exclusion&gt;
                          &lt;/exclusions&gt;
                      &lt;/dependency&gt;       
                  &lt;/dependencies&gt;
                  &lt;configuration&gt;
                      &lt;stopPort&gt;9966&lt;/stopPort&gt;
                      &lt;stopKey&gt;foo&lt;/stopKey&gt;
                      &lt;stopWait&gt;10&lt;/stopWait&gt;
                      &lt;jettyXml&gt;${basedir}/jetty-config/jetty-env.xml&lt;/jettyXml&gt;
                      &lt;systemProperties&gt;
                          &lt;systemProperty&gt;
                              &lt;name&gt;org.eclipse.jetty.util.log.Log&lt;/name&gt;
                              &lt;value&gt;org.eclipse.jetty.util.log.Slf4jLog&lt;/value&gt;
                          &lt;/systemProperty&gt;
                          &lt;systemProperty&gt;
                              &lt;name&gt;logback.configurationFile&lt;/name&gt;
                              &lt;value&gt;${basedir}/jetty-config/logback.xml&lt;/value&gt;
                          &lt;/systemProperty&gt;
                      &lt;/systemProperties&gt;
                      &lt;webApp&gt;
                          &lt;extraClasspath&gt;${basedir}/jetty-config/&lt;/extraClasspath&gt;
                      &lt;/webApp&gt; 
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  </code></pre>
  
  
  
  <p>Update 2: I adapted jms-config (now i don't use any CachingConnectionFactory):</p>
  
  <p>New jms-config:
  </p>
  
  <pre><code>&lt;bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"&gt; 
          &lt;property name="brokerURL" value="tcp://localhost:61616"/&gt;
      &lt;/bean&gt; 
      &lt;!--  
      &lt;bean id="cachingConnectionFactory" class="org.springframework.jms.connection.CachingConnectionFactory"&gt;
          &lt;property name="targetConnectionFactory" ref="connectionFactory"/&gt;
      &lt;/bean&gt; --&gt;
  
      &lt;bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
          &lt;property name="connectionFactory" ref="connectionFactory"/&gt;
          &lt;property name="sessionTransacted" value="true" /&gt;
      &lt;/bean&gt;
  </code></pre>
  
  
  
  <p>Nearly the same exception...
  </p>
  
  <pre><code>Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.apache.activemq.ActiveMQConnectionFactory] to required type [javax.jms.ConnectionFactory] for property 'connectionFactory': no matching editors or conversion strategy found
      at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:287) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:461) ~[spring-beans-4.1.6.RELEASE.jar:4.1.6.RELEASE]
      ... 30 common frames omitted
  </code></pre>