【问题标题】:java.lang.ClassNotFoundException: org.apache.activemq.camel.component.ActiveMQComponent not found from bundle [camel-activemq]java.lang.ClassNotFoundException: org.apache.activemq.camel.component.ActiveMQComponent 未从包中找到 [camel-activemq]
【发布时间】:2014-07-09 05:20:50
【问题描述】:

我试图将一个示例 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

【问题讨论】:

    标签: activemq karaf


    【解决方案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
    

    【讨论】:

      【解决方案2】:

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

      首先需要将包装改成bundle,

        <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>  
      

      【讨论】:

        猜你喜欢
        • 2016-12-03
        • 2021-05-30
        • 2021-12-17
        • 1970-01-01
        • 1970-01-01
        • 2021-12-09
        • 2011-11-15
        • 2016-06-29
        • 2021-12-01
        相关资源
        最近更新 更多