apache-camelosgiapache-karafjbossfuseapache-servicemix

How to solve java.lang.NoClassDefFoundError: org/apache/camel/impl/DefaultComponent?


I want to test a camel-component, written by a colleague and me. It runs on Karaf and the following camel bundles are deployed:

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

The component and a blueprint that uses the component is deployed, too. I think that I missed to install a camel feature, which provides the class DefaultComponent, so I think it's not necessary to review the code.

I get the following error:

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

Solution

  • My mistake was that I did not set up the Maven project of the Camel component correctly. To avoid this you can start the development of a Camel component with an archetype.

    So you could start like this:

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