[ https://issues.apache.org/jira/browse/CAMEL-9026?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14645664#comment-14645664 ]
Thomas Diesler commented on CAMEL-9026: --------------------------------------- [~ancosen] I suspect your run your test with a flat surefire classpath. In which case the test sees the transitive tree of mvn dependencies in scope test, provided, compile. If you do the same thing in a modular environment (i.e. wildfly) it would behave very differently. Although it is reasonable to assume that a deployment can see camel-kafka APIs, it is incorrect to assume that camel-kafka can use the deployments classloader to load internals that only camel-kafka should see. The handling/caching of classloaders in Kafka is a tragedy as well as it reliance on a particular TCCL. An API that works well in a modular environment makes little assumptions about classloaders. Instead it provides the caller with a means to pass in a CL of its choice. In this particular case, camel-kafka would want to pass to Kafka its own CL to load the StringEncoder > ClassNotFoundException: kafka.serializer.StringEncoder > ------------------------------------------------------ > > Key: CAMEL-9026 > URL: https://issues.apache.org/jira/browse/CAMEL-9026 > Project: Camel > Issue Type: Bug > Components: camel-kafka > Reporter: Thomas Diesler > Assignee: Andrea Cosentino > Fix For: 2.16.0 > > > KafkaEndpoint cannot load the StringEncoder because we do not expose the > Kafka API to user code. It's an implementation detail of the camel-kafka > component and only visible to that class loader > {code} > Caused by: java.lang.ClassNotFoundException: kafka.serializer.StringEncoder > at > org.apache.camel.impl.DefaultClassResolver.resolveMandatoryClass(DefaultClassResolver.java:80) > at > org.apache.camel.component.kafka.KafkaEndpoint.createProducer(KafkaEndpoint.java:83) > at > org.apache.camel.impl.ProducerCache.doGetProducer(ProducerCache.java:431) > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)