组件camel-jsonpath在添加到pom文件后出错

时间:2016-02-03 12:05:20

标签: apache-camel osgi

在一个干净的Camel项目中,我添加了以下依赖项:

<dependency>
  <groupId>org.apache.camel</groupId>
  <artifactId>camel-jsonpath</artifactId>
  <version>2.16.1</version>       
</dependency>

当我运行项目时,我得到以下错误。如果我删除该依赖项,它的工作原理我在两个不同的项目上尝试了这个,同样的事情发生了。还有什么必须添加到pom中才能使用jsonpath吗?它似乎抱怨ASM?

[INFO] Using org.apache.camel.test.blueprint.Main to initiate a CamelContext
[INFO] Starting Camel ...
[mel.test.blueprint.Main.main()] Activator                      INFO  Camel activator starting
[mel.test.blueprint.Main.main()] Activator                      INFO  Camel activator started
[         Blueprint Extender: 1] BlueprintContainerImpl         INFO  Bundle INT001_GetPostcodeDataFromXXX/0.0.1.SNAPSHOT is waiting for namespace handlers [http://camel.apache.org/schema/blueprint]
EventDispatcher: Error during dispatch.
EventDispatcher: Error during dispatch.
EventDispatcher: Error during dispatch.
EventDispatcher: Error during dispatch.
EventDispatcher: Error during dispatch.
org.osgi.framework.ServiceException: Service factory exception: org/objectweb/asm/commons/AdviceAdapter
        at org.apache.felix.connect.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:246)
        at org.apache.felix.connect.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:178)
        at org.apache.felix.connect.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:323)
        at org.apache.felix.connect.PojoSRBundleContext.getService(PojoSRBundleContext.java:162)
        at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.addingService(NamespaceHandlerRegistryImpl.java:113)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:864)
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
        at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:894)
        at org.apache.felix.connect.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:852)
        at org.apache.felix.connect.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:775)
        at org.apache.felix.connect.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:594)
        at org.apache.felix.connect.PojoSR$1.serviceChanged(PojoSR.java:78)
        at org.apache.felix.connect.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:130)
        at org.apache.felix.connect.PojoSRBundleContext.registerService(PojoSRBundleContext.java:101)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.registerService(BlueprintContainerImpl.java:453)
        at org.apache.aries.blueprint.container.ServiceRecipe.register(ServiceRecipe.java:193)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.registerServices(BlueprintContainerImpl.java:704)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:379)
        at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)
        at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/commons/AdviceAdapter
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.apache.aries.proxy.impl.interfaces.ProxyClassLoader.createProxyClass(ProxyClassLoader.java:146)
        at org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator.getProxyInstance(InterfaceProxyGenerator.java:95)
        at org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:80)
        at org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingInterceptingProxy(AbstractProxyManager.java:75)
        at org.apache.aries.proxy.impl.AbstractProxyManager.createInterceptingProxy(AbstractProxyManager.java:53)
        at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:569)
        at org.apache.felix.connect.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:242)
        ... 31 more
Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.commons.AdviceAdapter
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 49 more
org.osgi.framework.ServiceException: Service factory exception: org/objectweb/asm/commons/AdviceAdapter
        at org.apache.felix.connect.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:246)
        at org.apache.felix.connect.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:178)
        at org.apache.felix.connect.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:323)
        at org.apache.felix.connect.PojoSRBundleContext.getService(PojoSRBundleContext.java:162)
        at org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl.addingService(NamespaceHandlerRegistryImpl.java:113)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:932)
        at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:864)
        at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
        at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229)
        at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:894)
        at org.apache.felix.connect.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:852)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/objectweb/asm/commons/AdviceAdapter

编辑: 添加后:

<dependency>
    <groupId>org.ow2.asm</groupId>
    <artifactId>asm-commons</artifactId>
    <version>5.0.3</version>
    <scope>runtime</scope>
</dependency> 

它有效,但怀疑这是正确的方法。驼峰组件应该获得所有依赖的罐子。

3 个答案:

答案 0 :(得分:3)

我在Camel nabble论坛上发布了这个,事实上你似乎需要添加asm依赖来让它工作。

http://camel.465427.n5.nabble.com/Error-with-Camel-component-camel-jsonpath-td5777201.html

<dependency>
    <groupId>org.ow2.asm</groupId>
    <artifactId>asm-commons</artifactId>
    <version>5.0.3</version>
    <scope>runtime</scope>
</dependency> 

答案 1 :(得分:0)

在我的情况下,当使用版本5.0.3的asm-commons时,我仍然收到一些错误。作为对先前答案的替代,可以使用asm-all工件,因为它包含在我的方案中打破其他依赖性的其他依赖项。

<dependency>
  <groupId>org.ow2.asm</groupId>
  <artifactId>asm-all</artifactId>
  <scope>runtime</scope>
</dependency>

但是,关于部署,似乎很难将使用此依赖项的项目集成到Fabric8(控制台日志和容器上没有错误无法启动),因此不确定是否有更好的替代方案,使用某种类型的camel-jsonpath特征

希望它有所帮助。

答案 2 :(得分:-1)

pom.xml是关于编译时依赖性的。您有关于缺少依赖项的运行时错误(org.objectweb.asm)。您应该将它添加到容器中。

在堆栈跟踪中:在蓝图上下文中注册了新服务。然后将此服务注入另一个蓝图上下文中。对于这个服务,蓝图容器想要将它包装在一个新的代理中,并且为了创建这种代理,aries蓝图需要org.objectweb.asm。我不认为这个错误与camel-jsonpath直接相关。