title: Camel + MyBatis + Apache Aries
body: <p>I'm following the setup guide located at: <a href="http://camel.apache.org/mybatis.html" rel="nofollow" title="Camel MyBatis Integration Guide">Camel MyBatis Integration Guide</a>. I am using Service Mix 5.0.1. I used features-install spring-mybatis which pulled in 3.2.4.RELEASE. My SqlMapConfig file only contains information about the typeHandlers and typeAliases.</p>
  
  <p>When I start service mix and then start my app I receive the following stack trace:</p>
  
  <pre><code>org.osgi.service.blueprint.container.ComponentDefinitionException: Errorsetting property: PropertyDescriptor &lt;name: configLocation, getter: null, setter: [class org.mybatis.spring.SqlSessionFactoryBean.setConfigLocation(interface org.springframework.core.io.Resource)]
  at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[8:org.apache.aries.blueprint.core:1.4.0]
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45]
  at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:933)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[8:org.apache.aries.blueprint.core:1.4.0]
  at java.util.concurrent.FutureTask.run(FutureTask.java:262)[:1.7.0_45]
  at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:681)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:378)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:245)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:235)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[11:org.apache.aries.util:1.1.0]
  at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[11:org.apache.aries.util:1.1.0]
  at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[11:org.apache.aries.util:1.1.0]
  at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[11:org.apache.aries.util:1.1.0]
  at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[11:org.apache.aries.util:1.1.0]
  at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1103)[org.apache.felix.framework-4.0.3.jar:]
  at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:695)[org.apache.felix.framework-4.0.3.jar:]
  at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:483)[org.apache.felix.framework-4.0.3.jar:]
  at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)[org.apache.felix.framework-4.0.3.jar:]
  at org.apache.felix.framework.Felix.startBundle(Felix.java:1923)[org.apache.felix.framework-4.0.3.jar:]
  at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)[org.apache.felix.framework-4.0.3.jar:]
  at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:931)[org.apache.felix.framework-4.0.3.jar:]
  at org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:37)[39:org.apache.karaf.shell.osgi:2.3.4]
  at org.apache.karaf.shell.osgi.BundlesCommand.doExecute(BundlesCommand.java:37)[39:org.apache.karaf.shell.osgi:2.3.4]
  at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.karaf.shell.console.jline.Console.run(Console.java:183)[15:org.apache.karaf.shell.console:2.3.4]
  at org.apache.karaf.shell.console.jline.DelayedStarted.run(DelayedStarted.java:79)[15:org.apache.karaf.shell.console:2.3.4]
  *Caused by: java.lang.Exception: Unable to convert value /META-INF/SqlMapConfig.xml to type interface org.springframework.core.io.Resource. Type interface org.springframework.core.io.Resource is an interface or an abstract class* 
  at org.apache.aries.blueprint.container.AggregateConverter.createObject(AggregateConverter.java:310)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.AggregateConverter.convertFromString(AggregateConverter.java:304)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:174)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[8:org.apache.aries.blueprint.core:1.4.0]
  at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[8:org.apache.aries.blueprint.core:1.4.0]
  </code></pre>
  
  <p>... 50 more</p>
  
  <p>My Bean definitions are as follows:</p>
  
  <pre><code>&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy"&gt;
    &lt;argument&gt;
      &lt;bean class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt;
        &lt;property name="driverClass" value="oracle.jdbc.OracleDriver"/&gt;
        &lt;property name="jdbcUrl" value="jdbc:oracle:thin:@intersting-ip:port:schema"/&gt;
        &lt;property name="user" value="user"/&gt;
        &lt;property name="password" value="password"/&gt;
      &lt;/bean&gt;
    &lt;/argument&gt;
  &lt;/bean&gt;
  
  &lt;bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"&gt;
    &lt;property name="dataSource" ref="dataSource"/&gt;
    &lt;property name="configLocation" value="/META-INF/SqlMapConfig.xml"/&gt;
    &lt;property name="mapperLocations" value="classpath*:META-INF/mappers/**/*.xml"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mybatis" class="org.apache.camel.component.mybatis.MyBatisComponent"&gt;
    &lt;property name="sqlSessionFactory" ref="sqlSessionFactory" /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p><strong>Updating config and new error</strong></p>
  
  <p><strong>Updated Configuration:</strong></p>
  
  <pre><code>&lt;bean id="myBatis" class="org.apache.camel.component.mybatis.MyBatisComponent"&gt;
      &lt;property name="sqlSessionFactory" ref="sqlSessionFactory" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="mybatisConfig" class="org.springframework.core.io.ClassPathResource"&gt;
      &lt;argument value="classpath*:META-INF/SqlMapConfig.xml" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy"&gt;
      &lt;argument&gt;
          &lt;bean class="com.mchange.v2.c3p0.ComboPooledDataSource"&gt;
              &lt;property name="driverClass" value="oracle.jdbc.OracleDriver"/&gt;
              &lt;property name="jdbcUrl" value="jdbc:oracle:thin:@intersting-ip:port:schema"/&gt;
              &lt;property name="user" value="user"/&gt;
              &lt;property name="password" value="password"/&gt;
          &lt;/bean&gt;
      &lt;/argument&gt;
  &lt;/bean&gt;
  
  &lt;!-- Without this, the creation of myBatis will bomb out stating that org.mybatis.spring.SqlSessionFactoryBean is not an instance of org.apache.ibatis.session.SqlSessionFactory --&gt;
  &lt;bean id="sqlSessionFactory" class="org.apache.ibatis.session.SqlSessionFactory" factory-ref="sqlSessionFactoryBean" factory-method="getObject" /&gt;
  
  &lt;bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean"&gt;
      &lt;property name="dataSource" ref="cctvDataSource"/&gt;
      &lt;property name="configLocation" ref="mybatisConfig"/&gt;
      &lt;property name="mapperLocations"&gt;
          &lt;array value-type="org.springframework.core.io.Resource"&gt;
              &lt;bean class="org.springframework.core.io.ClassPathResource"&gt;
                  &lt;argument value="classpath*:META-INF/mappers/**/*.xml" /&gt;
              &lt;/bean&gt;
          &lt;/array&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p><strong>Updated Error</strong></p>
  
  <pre><code>2014-08-06 10:46:20,824 | ERROR | mix\5.0.1/deploy | BlueprintContainerImpl | ?? | 7 - org.apache.aries.blueprint.core - 1.4.0 | Unable to start blueprint container for bundle project org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean sqlSessionFactory of class interface org.apache.ibatis.session.SqlSessionFactory
  ....
  Caused by: java.io.FileNotFoundException: class path resource [classpath*:META-INF/SqlCookConfig.xml] cannot be opened because it does not exist
    at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:157)
    at org.mybatis.spring.SqlSessionFactoryBean.buildSqlSessionFactory(SqlSessionFactoryBean.java:358)
   at org.mybatis.spring.SqlSessionFactoryBean.afterPropertiesSet(SqlSessio
  </code></pre>
  
  <p>nFactoryBean.java:340)</p>