1

我尝试将一个示例 activemq 应用程序部署到 karaf。在部署和启动捆绑包时,我收到了这个错误。请帮我解决这个问题。我已将所有必需的 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
4

2 回答 2

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 和 camel-jms。

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

karaf@root()> feature:repo-add activemq 5.10.0
于 2014-07-27T11:05:04.040 回答
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>  
于 2014-07-10T07:28:06.450 回答