我正在遵循位于Camel MyBatis Integration guide的安装指南。我使用的是Service Mix 5.0.1。我使用了安装spring mybatis的功能,它支持3.2.4。释放我的SqlMapConfig文件只包含有关TypeHandler和TypeAlias的信息。
当我开启服务混合,然后启动我的应用程序,我收到以下堆栈跟踪:
org.osgi.service.blueprint.container.ComponentDefinitionException: Errorsetting property: PropertyDescriptor <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]
...还有50个
我的Bean定义如下:
<bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
<argument>
<bean class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="oracle.jdbc.OracleDriver"/>
<property name="jdbcUrl" value="jdbc:oracle:thin:@intersting-ip:port:schema"/>
<property name="user" value="user"/>
<property name="password" value="password"/>
</bean>
</argument>
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="/META-INF/SqlMapConfig.xml"/>
<property name="mapperLocations" value="classpath*:META-INF/mappers/**/*.xml"/>
</bean>
<bean id="mybatis" class="org.apache.camel.component.mybatis.MyBatisComponent">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
更新配置和新错误
更新配置:
<bean id="myBatis" class="org.apache.camel.component.mybatis.MyBatisComponent">
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<bean id="mybatisConfig" class="org.springframework.core.io.ClassPathResource">
<argument value="classpath*:META-INF/SqlMapConfig.xml" />
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
<argument>
<bean class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="oracle.jdbc.OracleDriver"/>
<property name="jdbcUrl" value="jdbc:oracle:thin:@intersting-ip:port:schema"/>
<property name="user" value="user"/>
<property name="password" value="password"/>
</bean>
</argument>
</bean>
<!-- 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 -->
<bean id="sqlSessionFactory" class="org.apache.ibatis.session.SqlSessionFactory" factory-ref="sqlSessionFactoryBean" factory-method="getObject" />
<bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="cctvDataSource"/>
<property name="configLocation" ref="mybatisConfig"/>
<property name="mapperLocations">
<array value-type="org.springframework.core.io.Resource">
<bean class="org.springframework.core.io.ClassPathResource">
<argument value="classpath*:META-INF/mappers/**/*.xml" />
</bean>
</array>
</property>
</bean>
更新错误
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
nFactoryBean。爪哇:340)
你使用的指南是针对Spring而不是白羊座的蓝图,这是问题的主要来源。mybatis-Spring用于集成,它使用Spring特定的东西。
问题在于SqlSessionFactoryBean
的configLocation
属性。应该是springorg。springframework。果心伊奥。资源
。如果使用前缀给出提示,Spring可以自动将字符串转换为资源
。白羊座对spring一无所知,也没有内置从String
到springResource
的转换器。
如何解决这个问题有两种选择:
Resource
实现bean注入SqlSessionFactoryBean
而不是string在这两种情况下,你都可以使用org。springframework。果心伊奥。ClassPathResource
或自己实现资源。
我正在使用带有Apache骆驼的Spring Boot。我正在从控制器调用路由。一旦路由完成,控制就会返回控制器。我正在VerifyLimitProcess和批准限制处理器中生成响应。如果我没有在路由中提供窃听配置,控制器会按预期检索标头和正文。但如果我在路由中引入窃听,控制器会将标头和正文接收为null。如果有人指出我需要做什么,以便我可以在选择语句中引入两个处理器的窃听配置,即VerifyLi
我有一条小路线,我想使用自定义的重新传递策略来重复向endpoint发送消息,但这种行为非常奇怪。看起来,重新交付政策只是在重复一个错误。我试图将所有交换发送到路由的开头,但策略不起作用,因为每次都在创建: 我做错了什么?当错误发生时,我想以间隔重复我的请求。我的骆驼版本是2.6 日志:
我有一个Quarkus应用程序,它使用Apache-Camel并在本地运行良好。当我构建它并尝试运行docker容器时,我收到以下错误: 我的分级依赖关系是 } 当我在IntelliJ终端中使用“夸克斯开发”运行它时,我没有问题。我是否尝试运行容器,但会出现错误。为什么会发生这种情况?我不知道如何解决它。 编辑: 处理HttpException的位置: 处理程序本身: }
我试图弄清楚骆驼的节流概念。我已经看到了骆驼的航线政策,但这适用于许多飞行中的交换。 我的路线如下: 现在我的用例是,我想在这些路由之间传输比如说2000条消息,我知道可以通过来完成。但是,我不得不决定如何在下一个2000条消息被路由时控制它。我只想在接收者队列变为空时路由下2000条消息。 例如,消息从队列路由到。假设2K消息已成功路由,现在我想挂起我的路由,这样它就不会传输更多的消息,直到队列
我有一个Spring Boot2.25.1应用程序,它使用Camel 2.25.1与camel-kafka,一切都正常工作…在我的Kafka消费者中,我需要添加该功能以按需暂停消费,因此我升级到camel 3.18.1,以便我可以使用可暂停功能。升级到3.18.1后,我收到错误FileNotes与类文件TimeoutAwareAggregationStategy.class. 当我打开camel-
我最近注意到Camel现在有自己的Kafka组件,所以我决定给它一个旋转。 我决定尝试一个很好的简单文件->kafka主题如下...