java.lang.ClassNotFoundException:org.apache.activemq.camel.component.ActiveMQComponent未找到bundle [camel-activemq]

时间:2014-07-09 05:20:51

标签: activemq karaf

我尝试将示例activemq应用程序部署到karaf.While部署并启动bundle我得到了这个错误。请帮我解决这个问题。 我已将所有必需的activemq组件安装到karaf中。 仍然收到以下错误。

karaf@root()> Exception in thread "SpringOsgiExtenderThread-7" org.springframework.beans.factory.CannotLoadBeanClassException: Can
not find class [org.apache.activemq.camel.component.ActiveMQComponent] for bean with name 'activemq' defined in URL [bundle://1171
.4:0/META-INF/spring/camel-context.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.activemq.camel.component
.ActiveMQComponent not found from bundle [camel-activemq]
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1275)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBea
nFactory.java:575)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1344)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:910)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactor
y.java:609)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationConte
xt.java:932)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExec
utionApplicationContext.java:69)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionA
pplicationContext.java:355)
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegated
ExecutionApplicationContext.java:320)
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefr
eshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
        at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.camel.component.ActiveMQComponent not found from bundle [camel-ac
tivemq]
        at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
        at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:260)
        at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:416)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1296)
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1267)
        ... 11 more
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.camel.component.ActiveMQComponent not found by camel-activemq [11
71]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1844)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)
        at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
        ... 17 more

2 个答案:

答案 0 :(得分:1)

你错过了activemq-camel功能。

登录karaf并发出以下命令:

对于Karaf 2.3.x:

> features:chooseurl activemq
> features:install activemq-camel

对于Karaf 3.0.x:

karaf@root()> feature:repo-add activemq
karaf@root()> feature:install activemq-camel

activemq-camel功能还将安装activemq-client&骆驼JMS。

您可能需要在存储库命令中提供特定的版本号,具体取决于捆绑包中嵌入的版本控制信息。 E.g:

karaf@root()> feature:repo-add activemq 5.10.0

答案 1 :(得分:0)

这个camel-activemq项目是一个上游原型,你可以用它来快速启动骆驼。 要在karaf中使用它,您需要添加捆绑清单。

首先需要将打包更改为捆绑,

  <packaging>bundle</packaging>

然后添加此部分

  <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <version>2.3.7</version>
    <extensions>true</extensions>
    <configuration>
      <instructions>
        <Bundle-SymbolicName>camel-activemq</Bundle-SymbolicName>
        <Import-Package>*,org.apache.activemq.camel.component</Import-Package>
      </instructions>
    </configuration>
  </plugin>