Class not found org.apache.kafka.clients.consumer.RangeAssignor in Spring XD module using Spring Kafka Integration with XML configuration
<p>I am receiving the follow exception when I try construct a Kafka consumer in my xd module:</p>

<pre><code>    Caused by: org.apache.kafka.common.KafkaException: Failed to construct kafka consumer
at org.apache.kafka.clients.consumer.KafkaConsumer.&lt;init&gt;(KafkaConsumer.java:702) ~[na:na]
at org.apache.kafka.clients.consumer.KafkaConsumer.&lt;init&gt;(KafkaConsumer.java:557) ~[na:na]
at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createKafkaConsumer(DefaultKafkaConsumerFactory.java:73) ~[na:na]
at org.springframework.kafka.core.DefaultKafkaConsumerFactory.createConsumer(DefaultKafkaConsumerFactory.java:69) ~[na:na]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.&lt;init&gt;(KafkaMessageListenerContainer.java:284) ~[na:na]
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.&lt;init&gt;(KafkaMessageListenerContainer.java:222) ~[na:na]
at org.springframework.kafka.listener.KafkaMessageListenerContainer.doStart(KafkaMessageListenerContainer.java:179) ~[na:na]
at org.springframework.kafka.listener.AbstractMessageListenerContainer.start(AbstractMessageListenerContainer.java:204) ~[na:na]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173) ~[spring-context-4.1.7.RELEASE.jar:4.1.7.RELEASE]
... 27 common frames omitted
Caused by: org.apache.kafka.common.KafkaException: org.apache.kafka.clients.consumer.RangeAssignor ClassNotFoundException exception occured
at org.apache.kafka.common.config.AbstractConfig.getConfiguredInstances(AbstractConfig.java:227) ~[na:na]
at org.apache.kafka.clients.consumer.KafkaConsumer.&lt;init&gt;(KafkaConsumer.java:637) ~[na:na]
... 35 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.apache.kafka.clients.consumer.RangeAssignor
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_77]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_77]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_77]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_77]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_77]
at org.apache.kafka.common.utils.Utils.newInstance(Utils.java:332) ~[na:na]
at org.apache.kafka.common.config.AbstractConfig.getConfiguredInstances(AbstractConfig.java:225)
</code></pre>

<p>Here is my xml:</p>

<pre><code>&lt;int-kafka:message-driven-channel-adapter
    id="kafkaListener" listener-container="customKafkaMessageListenerContainer"
    auto-startup="false" phase="100" send-timeout="5000" channel="toTransformer"
    error-channel="errorChannel"/&gt;

&lt;bean id="containerProps"
    class="org.springframework.kafka.listener.config.ContainerProperties"&gt;
    &lt;constructor-arg name="topicPartitions" ref="topicPartitionInitialOffset" /&gt;
&lt;/bean&gt;

&lt;bean id="topicPartitionInitialOffset"
    class="org.springframework.kafka.support.TopicPartitionInitialOffset"&gt;
    &lt;constructor-arg index="0" name="topic" value="source-8-26"
        type="java.lang.String" /&gt;
    &lt;constructor-arg index="1" name="partition" value="0"
        type="int" /&gt;
    &lt;constructor-arg index="2" name="initialOffset" value="0"
        type="java.lang.Long" /&gt;
&lt;/bean&gt;

&lt;bean id="consumerFactory"
    class="org.springframework.kafka.core.DefaultKafkaConsumerFactory"&gt;
    &lt;constructor-arg&gt;
        &lt;map&gt;
            &lt;entry key="bootstrap.servers" value="localhost:9092" /&gt;
            &lt;entry key="group.id" value="test-consumer-group" /&gt;
            &lt;entry key="autocommit.enable" value="false" /&gt;
            &lt;entry key="value.deserializer" value-type="java.lang.Class" value="org.apache.kafka.common.serialization.StringSerializer"&gt;
            &lt;/entry&gt;
            &lt;entry key="key.deserializer" value-type="java.lang.Class" value="org.apache.kafka.common.serialization.StringSerializer"&gt;
            &lt;/entry&gt;
        &lt;/map&gt;
    &lt;/constructor-arg&gt;
&lt;/bean&gt;

&lt;bean id="customKafkaMessageListenerContainer"
    class="org.springframework.kafka.listener.KafkaMessageListenerContainer"&gt;
    &lt;constructor-arg name="consumerFactory" ref="consumerFactory"&gt;
    &lt;/constructor-arg&gt;
    &lt;constructor-arg name="containerProperties" ref="containerProps" /&gt;
&lt;/bean&gt;
</code></pre>

<p>Dependencies:</p>

<pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.integration&lt;/groupId&gt;
        &lt;artifactId&gt;spring-integration-kafka&lt;/artifactId&gt;
        &lt;version&gt;2.0.1.RELEASE&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
        &lt;artifactId&gt;kafka-clients&lt;/artifactId&gt;
        &lt;version&gt;0.10.0.1&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
        &lt;artifactId&gt;kafka_2.11&lt;/artifactId&gt;
        &lt;version&gt;0.10.0.1&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.kafka&lt;/groupId&gt;
        &lt;artifactId&gt;spring-kafka&lt;/artifactId&gt;
        &lt;version&gt;1.0.3.RELEASE&lt;/version&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;
</code></pre>

<p>Does anyone know why I am getting this class not found exception? I checked the API for Kafka 0.10.0 and the class exists, so I'm not sure why I am receiving this exception.  Could it have to do with how Spring XD loads the classes?  I know that Spring XD comes with Kafka 0.8.2 in its lib folder, so maybe Spring XD is loading Kafka 0.8.2 first and then its unable to find the class because of that?</p>

<p>Any insight would greatly be appreciated!</p>