【问题标题】:How to solve java.lang.NoClassDefFoundError: org/apache/camel/impl/DefaultComponent?如何解决 java.lang.NoClassDefFoundError: org/apache/camel/impl/DefaultComponent?
【发布时间】:2019-03-26 15:51:11
【问题描述】:

我想测试一个由我和同事编写的骆驼组件。它在Karaf 上运行,并部署了以下camel 捆绑包:

80 │ Active  │  50 │ 2.17.1         │ camel-blueprint
81 │ Active  │  50 │ 2.17.1         │ camel-catalog
82 │ Active  │  50 │ 2.17.1         │ camel-core

组件和使用该组件的蓝图也被部署。我认为我错过了安装骆驼功能,它提供类 DefaultComponent,所以我认为没有必要审查代码。

我收到以下错误:

java.lang.NoClassDefFoundError: org/apache/camel/impl/DefaultComponent

【问题讨论】:

  • 那个类来自camel-core,所以它应该在那里。也许该错误是由它以某种方式隐藏的其他错误引起的。还要检查您尝试安装的捆绑包是否具有正确的 osgi 导入等。此外,您还需要详细说明您在该捆绑包中执行的操作导致此错误,也许您没有为 osgi 等设置正确的设置。
  • 我检查了现有的camel-components 并注意到,我们在 mavens pom.xml 中忘记了一些 osgi 属性。所以我在camel.osgi.export.pkgcamel.osgi.import.additionalcamel.osgi.export.service中设置了属性pom 现在可以找到 DefaultComponent 的 ClassDef 了。所以你是对的@ClausIbsen - 我们没有为 osgi 正确设置它。

标签: apache-camel osgi apache-karaf jbossfuse apache-servicemix


【解决方案1】:

我的错误是我没有正确设置Camel组件的Maven项目。为避免这种情况,您可以使用 archetype 开始开发 Camel 组件。

所以你可以这样开始:

mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-component -DarchetypeVersion=2.24.2

【讨论】:

    猜你喜欢
    • 2014-02-07
    • 2014-10-06
    • 1970-01-01
    • 2015-05-31
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 2015-12-02
    • 1970-01-01
    相关资源
    最近更新 更多