0 Replies Latest reply on Feb 13, 2018 11:13 AM by Gaurav Pant

    org.apache.kafka.clients.producer.ProducerConfig Class not found exception in camel-kafka

    Gaurav Pant Newbie

      @

      I am using camel with fuse. Camel version is : 2.17.0.redhat-630187

      I am trying to integrate kafka with camel, so for that Ihave added below two dependecies in pom.xml

           <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-kafka</artifactId> <version>2.17.0.redhat-630187</version> </dependency>  <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> <version>0.9.0.1</version> </dependency> 

      From my camel route I am trying to produce like:

      <route id="produceKakfaCheck"> <from uri="direct-vm:xxx"/> <setHeader headerName="kafka.PARTITION_KEY"> <constant>Test</constant> </setHeader> <to uri="kafka:<IP>:9092?topic=ILTester&amp;serializerClass=kafka.serializer.StringEncoder" /> </route> 

      As a prerequisite I have installed camel-kakfa in fuse also using below command

      features:install camel-kafka 

      and have verified that came-kafka and kafka-client bundles are active in java.

      but on installing my bundle in fuse I am getting below error: ERROR: Bundle Profile [1179] EventDispatcher: Error during dispatch. (java.lang.NoClassDefFoundError: Could not initialize class org.apache.kafka.clients.producer.ProducerConfig) java.lang.NoClassDefFoundError: Could not initialize class org.apache.kafka.clients.producer.ProducerConfig at org.apache.kafka.clients.producer.KafkaProducer.(KafkaProducer.java:181) at org.apache.camel.component.kafka.KafkaProducer.doStart(KafkaProducer.java:75) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.impl.DefaultCamelContext.startService(DefaultCamelContext.java:3275) at org.apache.camel.impl.DefaultCamelContext.doAddService(DefaultCamelContext.java:1243) at org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:1204) at org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:442) at org.apache.camel.impl.ProducerCache.acquireProducer(ProducerCache.java:160) at org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:243) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) at org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:1372) at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:44) at org.apache.camel.support.ChildServiceSupport.start(ChildServiceSupport.java:31) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) at org.apache.camel.processor.interceptor.DefaultChannel.doStart(DefaultChannel.java:156) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:62) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) at org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:1149) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:104) at org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:90) at org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:79) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) at org.apache.camel.impl.RouteService.startChildService(RouteService.java:340) at org.apache.camel.impl.RouteService.warmUp(RouteService.java:182) at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3496) at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3426) at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3203) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3059) at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:175) at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2854) at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:2850) at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:2873) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:2850) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:2819) at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:185) at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:217) at org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:155) at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:943) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:794) at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:544) at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4445) at org.apache.felix.framework.Felix.registerService(Felix.java:3431) at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346) at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:353) at org.apache.camel.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:105) at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:299) at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:980) at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:736) at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:848) at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811) at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88) at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247) at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230) at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145) at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:760) at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelInjector.getCamelContext(CamelNamespaceHandler.java:783) at org.apache.camel.impl.CamelPostProcessorHelper.createInjectionProducerTemplate(CamelPostProcessorHelper.java:290) at org.apache.camel.impl.CamelPostProcessorHelper.getInjectionValue(CamelPostProcessorHelper.java:205) at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelInjector.injectField(CamelNamespaceHandler.java:831) at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelInjector.injectFields(CamelNamespaceHandler.java:823) at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelInjector.afterInit(CamelNamespaceHandler.java:935) at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcPostInit(BeanRecipe.java:768) at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:850) at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811) at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88) at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247) at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183) at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:688) at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:383) at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:270) at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294) at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263) at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253) at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500) at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433) at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725) at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463) at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422) at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1127) at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696) at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484) at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4429) at org.apache.felix.framework.Felix.startBundle(Felix.java:2100) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:976) at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:963) at org.apache.karaf.shell.osgi.StartBundle.doExecute(StartBundle.java:37) at org.apache.karaf.shell.osgi.BundlesCommand.doExecute(BundlesCommand.java:37) at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38) at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35) at sun.reflect.GeneratedMethodAccessor265.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54) at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119) at org.apache.karaf.shell.console.commands.$BlueprintCommand1908438348.execute(Unknown Source) at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78) at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477) at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403) at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108) at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183) at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120) at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:92) at org.apache.karaf.shell.console.jline.Console.run(Console.java:197) at org.apache.karaf.shell.console.jline.DelayedStarted.run(DelayedStarted.java:79)

      Any help in this regard is highly appreciated.