This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Why do Camel throw so many NoClassDefFoundException on startup
Skip to end of metadata
Go to start of metadata

Why do Camel throw so many NoClassDefFoundException on startup

Camel uses a runtime strategy to discover features while it starts up. This is used to register components, languages, type converters etc.

If you are using the uber .jar (the big camel.jar) with all the camel components in a single .jar filen, the this problem can typically occur.
Especially the type converters is know to cause NoClassDefFoundException in the log during startup. The reasons is that some of these type converters rely on 3rd. party .jar files.

To remedy this either add the missing .jars to the classpath, or stop using the big .jar and use the fine grained jars.

See also How do I use a big (uber) JAR?

  • No labels


  1. Here's a bit more information for people that might be having this problem.

    The messages you typically see (because they are at the warning level and above) are one-line messages that look like these:

    Could not find class 'org/apache/camel/component/file/remote/SftpEndpoint$1.class' in any classloaders
    Could not find class 'org/apache/camel/scala/Frequency.class' in any classloaders
    Could not find class 'org/apache/camel/component/jhc/AsyncBufferingHttpServiceHandler.class' in any classloaders

    and long stack traces in which a NoClassDefFoundError is shown as caused by a ClassNotFoundException, like this:

    Ignoring converter type: org.apache.camel.component.jhc.JhcConverter as a dependent class could not be found: java.lang.NoClassDefFoundError: org/apache/http/HttpEntity
    java.lang.NoClassDefFoundError: org/apache/http/HttpEntity
    Caused by: java.lang.ClassNotFoundException: org.apache.http.HttpEntity

    All of these messages, even the short ones, are caused by the absence of third-party jars that implement the software that various Camel connectors connect to. For example, the Camel connector to Scala needs the Scala implementation jar to complete its initialization. So the way to eliminate the Scala messages is either to supply the Scala implementation jar or to eliminate the Camel Scala connector from your class path. The Camel Scala connector is in the appropriate little jar, lib/camel-scala-x.x.x.jar, but it is also in the big, all-purpose apache-camel-x.x.x.jar.

    1. The important thing to realize is that, as frightening as these messages are, all of them can be ignored. Unless you are actually using one of the complaining connectors, Camel will work just fine even without either of these workarounds.