gravitee-io / issues

Gravitee.io - API Platform - Issues
64 stars 26 forks source link

[reporter][kafka]ClassNotFoundException : io.gravitee.reporter.kafka.spring.EnabledKafkaReporter #1805

Closed sjoss closed 5 years ago

sjoss commented 5 years ago

Expected Behavior

we want to used Kafka reporter to exploit the logs

Current Behavior

if we install the reporter-kafka from https://download.gravitee.io/graviteeio-apim/plugins/reporters/gravitee-reporter-kafka/ : the gatway send a ClassNotFoundException

java.lang.IllegalArgumentException: Could not find class [io.gravitee.reporter.kafka.spring.EnabledKafkaReporter]
    at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:313)
    at org.springframework.context.annotation.ConditionEvaluator.getCondition(ConditionEvaluator.java:124)
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:96)
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:88)
    at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:71)
    at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.doRegisterBean(AnnotatedBeanDefinitionReader.java:217)
    at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:145)
    at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:135)
    at org.springframework.context.annotation.AnnotationConfigApplicationContext.register(AnnotationConfigApplicationContext.java:158)
    at io.gravitee.plugin.core.internal.AnnotationBasedPluginContextConfigurer.lambda$applicationContext$0(AnnotationBasedPluginContextConfigurer.java:86)
    at java.lang.Iterable.forEach(Iterable.java:75)
    at io.gravitee.plugin.core.internal.AnnotationBasedPluginContextConfigurer.applicationContext(AnnotationBasedPluginContextConfigurer.java:86)
    at io.gravitee.plugin.core.internal.PluginContextFactoryImpl.create(PluginContextFactoryImpl.java:51)
    at io.gravitee.plugin.core.internal.PluginContextFactoryImpl.create(PluginContextFactoryImpl.java:73)
    at io.gravitee.node.reporter.plugin.ReporterPluginHandler.handle(ReporterPluginHandler.java:60)
    at io.gravitee.plugin.core.internal.PluginEventListener.lambda$null$2(PluginEventListener.java:110)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.Iterator.forEachRemaining(Iterator.java:116)
    at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at io.gravitee.plugin.core.internal.PluginEventListener.lambda$deployPlugins$3(PluginEventListener.java:108)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
    at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
    at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1625)
    at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
    at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
    at io.gravitee.plugin.core.internal.PluginEventListener.deployPlugins(PluginEventListener.java:105)
    at io.gravitee.plugin.core.internal.PluginEventListener.deployPlugins(PluginEventListener.java:93)
    at io.gravitee.plugin.core.internal.PluginEventListener.onEvent(PluginEventListener.java:63)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:44)
    at io.gravitee.common.event.impl.EventManagerImpl.publishEvent(EventManagerImpl.java:36)
    at io.gravitee.plugin.core.internal.PluginRegistryImpl.init(PluginRegistryImpl.java:105)
    at io.gravitee.plugin.core.internal.PluginRegistryImpl.doStart(PluginRegistryImpl.java:81)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.node.container.AbstractNode.doStart(AbstractNode.java:74)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at io.gravitee.node.container.AbstractContainer.doStart(AbstractContainer.java:89)
    at io.gravitee.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:32)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at io.gravitee.gateway.standalone.boostrap.Bootstrap.start(Bootstrap.java:162)
    at io.gravitee.gateway.standalone.boostrap.Bootstrap.main(Bootstrap.java:171)
Caused by: java.lang.ClassNotFoundException: io.gravitee.reporter.kafka.spring.EnabledKafkaReporter
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:274)
    at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:310)
    ... 53 common frames omitted

We have the same issue if we build from master (gravitee-reporter-kafka-1.1.0-snap.zip)

Possible Solution

quick fix : remove the spring controler (it call EnabledKafkaReporter)

Context

we cannot log in kafka

Your Environment

brasseld commented 5 years ago

Why not providing a PR instead of saying what we have to do to fix the issue ?

sjoss commented 5 years ago

you're right and I'm doing code (and PR). :smiley: it's just a process problem : if you preffer an issue to discuss the problem then a PR or PR directly ...

brasseld commented 5 years ago

We need both ;)

See https://github.com/gravitee-io/gravitee-gateway/blob/master/CONTRIBUTING.adoc

sjoss commented 5 years ago

ok, I do it again my PR cleanly ...

brasseld commented 5 years ago

Closed by https://github.com/gravitee-io/gravitee-reporter-kafka/pull/4