我正在开始非常简单的驼峰蓝图项目,它在karaf(servicemix)中运行良好(或类似的东西),但为了在我的机器上开发和调试,我想将它与camel-maven集成-plugin。
我的蓝图看起来像是:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/spring/camel-blueprint.xsd">
<cm:property-placeholder persistent-id="ru.igc.igsb" update-strategy="reload">
<cm:default-properties>
<cm:property name="csvPath" value="C:/files"/>
</cm:default-properties>
</cm:property-placeholder>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="file:{{csvPath}}"/>
<log message="The message contains ${body}"/>
</route>
</camelContext>
</blueprint>
我的pom有这个:
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<!-- optional, default value: org.apache.camel.spring.Main -->
<configuration>
<useBlueprint>true</useBlueprint>
</configuration>
</plugin>
但驼峰:跑失败:
EventDispatcher: Error during dispatch.
org.osgi.framework.ServiceException: Service factory exception: java.lang.AbstractMethodError: org.apache.aries.proxy.impl.JdkProxyManager.createProxy(Lorg/osgi/framework/Bundle;Ljava/util/Collection;Ljava/util/concurrent/Callable;)Ljava/lang/Object;
at de.kalpatec.pojosr.framework.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:236)
at de.kalpatec.pojosr.framework.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:168)
at de.kalpatec.pojosr.framework.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:308)
at de.kalpatec.pojosr.framework.PojoSRBundleContext.getService(PojoSRBundleContext.java:156)
at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.addingService(NamespaceHandlerRegistryImpl.java:90)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)
at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840)
at de.kalpatec.pojosr.framework.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:872)
at de.kalpatec.pojosr.framework.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:792)
at de.kalpatec.pojosr.framework.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:540)
at de.kalpatec.pojosr.framework.PojoSR$1.serviceChanged(PojoSR.java:66)
at de.kalpatec.pojosr.framework.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:116)
at de.kalpatec.pojosr.framework.PojoSRBundleContext.registerService(PojoSRBundleContext.java:95)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.registerService(BlueprintContainerImpl.java:404)
at org.apache.aries.blueprint.container.ServiceRecipe.register(ServiceRecipe.java:184)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.registerServices(BlueprintContainerImpl.java:662)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:330)
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: java.lang.AbstractMethodError: org.apache.aries.proxy.impl.JdkProxyManager.createProxy(Lorg/osgi/framework/Bundle;Ljava/util/Collection;Ljava/util/concurrent/Callable;)Ljava/lang/Object;
at org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:98)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)
at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:799)
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:773)
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:754)
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:720)
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)
at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)
at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)
at org.apache.aries.blueprint.container.ServiceRecipe.createRecipe(ServiceRecipe.java:370)
at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:278)
at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:248)
at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:327)
at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:430)
at de.kalpatec.pojosr.framework.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:232)
... 27 more
Caused by: java.lang.AbstractMethodError: org.apache.aries.proxy.impl.JdkProxyManager.createProxy(Lorg/osgi/framework/Bundle;Ljava/util/Collection;Ljava/util/concurrent/Callable;)Ljava/lang/Object;
at org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createProxy(AbstractServiceReferenceRecipe.java:236)
at org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:82)
... 42 more
[ERROR] *************************************
[ERROR] Error occurred while running main from: org.apache.camel.test.blueprint.Main
[ERROR]
答案 0 :(得分:1)
可能缺少依赖(参见https://issues.apache.org/jira/browse/CAMEL-9321)。
<强>解决方案强>
添加
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.core</artifactId>
</dependency>
进入依赖项 - pom.xml的部分(根目录,而不是 / bin 下的派生 pom.xml )。< / p>
希望这有帮助。
答案 1 :(得分:0)
我刚刚使用了ServiceMix 5.4.x中的camel示例(https://github.com/apache/servicemix/tree/servicemix-5.4.x/examples/camel/camel-blueprint),用你的蓝图取代现有的蓝图,并将插件添加到pom文件
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>2.14.1</version>
<!-- optional, default value: org.apache.camel.spring.Main -->
<configuration>
<useBlueprint>true</useBlueprint>
</configuration>
</plugin>
它对我有用。请将您的项目(尤其是pom文件)与示例项目进行比较。请确保使用相同的camel和camel插件版本。