micronaut-projects / micronaut-discovery-client

Micronaut's Discovery Client
Apache License 2.0
22 stars 21 forks source link

Error occurred during service registration with Consul, app throw UnimplementedAdviceException #508

Closed 070hm closed 6 months ago

070hm commented 1 year ago

Expected Behavior

The app should register themself in the consul server

Actual Behaviour

When i run the app , the app throw UnimplementedAdviceException

03:46:11.732 [main] ERROR i.m.d.registration.AutoRegistration - Error occurred during service registration with Consul: All possible Introduction advise exhausted and no implementation found for method: Publisher register(NewServiceEntry entry)
io.micronaut.aop.exceptions.UnimplementedAdviceException: All possible Introduction advise exhausted and no implementation found for method: Publisher register(NewServiceEntry entry)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:126)
    at io.micronaut.aop.chain.AbstractInterceptorChain.proceed(AbstractInterceptorChain.java:171)
    at io.micronaut.aop.chain.InterceptorChain.proceed(InterceptorChain.java:46)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResultAsPublisher(PublisherInterceptedMethod.java:70)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResult(PublisherInterceptedMethod.java:87)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResult(PublisherInterceptedMethod.java:39)
    at io.micronaut.retry.intercept.DefaultRetryInterceptor.retrySync(DefaultRetryInterceptor.java:228)
    at io.micronaut.retry.intercept.DefaultRetryInterceptor.intercept(DefaultRetryInterceptor.java:129)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResultAsPublisher(PublisherInterceptedMethod.java:65)
    at io.micronaut.validation.ValidatingInterceptor.intercept(ValidatingInterceptor.java:129)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.discovery.consul.client.v1.AbstractConsulClient$Intercepted.register(Unknown Source)
    at io.micronaut.discovery.consul.registration.ConsulAutoRegistration.register(ConsulAutoRegistration.java:263)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:58)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:38)
    at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:266)
    at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:226)
    at io.micronaut.http.server.netty.discovery.NettyServiceDiscovery.onStart(NettyServiceDiscovery.java:51)
    at io.micronaut.http.server.netty.discovery.$NettyServiceDiscovery$Definition$Exec.dispatch(Unknown Source)
    at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:442)
    at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:3858)
    at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:84)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.http.server.netty.discovery.NettyServiceDiscovery$ApplicationEventListener$onStart1$Intercepted.onApplicationEvent(Unknown Source)
    at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:266)
    at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:226)
    at io.micronaut.http.server.netty.NettyHttpServer.fireStartupEvents(NettyHttpServer.java:603)
    at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:304)
    at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:104)
    at io.micronaut.runtime.Micronaut.start(Micronaut.java:79)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:322)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:297)

Steps To Reproduce

This is my application.properties

micronaut.application.name=chatService micronaut.application.instance.id=${random.shortuuid} micronaut.server.port=8086

consul

consul.client.defaultZone=${CONSUL_HOST:localhost}:${CONSUL_PORT:8500} consul.client.registration.enabled=true

My dependencies

`

io.micronaut micronaut-http-server-netty compile
    <dependency>
        <groupId>io.micronaut</groupId>
        <artifactId>micronaut-websocket</artifactId>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>io.micronaut.kotlin</groupId>
        <artifactId>micronaut-kotlin-runtime</artifactId>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>io.micronaut.serde</groupId>
        <artifactId>micronaut-serde-jackson</artifactId>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-reflect</artifactId>
        <version>${kotlinVersion}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jdk8</artifactId>
        <version>${kotlinVersion}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.fasterxml.jackson.module</groupId>
        <artifactId>jackson-module-kotlin</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>io.micronaut</groupId>
        <artifactId>micronaut-http-client</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>io.micronaut.test</groupId>
        <artifactId>micronaut-test-junit5</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-engine</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jetbrains.kotlinx</groupId>
        <artifactId>kotlinx-coroutines-reactor</artifactId>
    </dependency>

    <dependency>
        <groupId>io.projectreactor.kotlin</groupId>
        <artifactId>reactor-kotlin-extensions</artifactId>
    </dependency>

    <dependency>
        <groupId>io.micronaut.redis</groupId>
        <artifactId>micronaut-redis-lettuce</artifactId>
    </dependency>

    <dependency>
        <groupId>com.google.protobuf</groupId>
        <artifactId>protobuf-java</artifactId>
        <version>${protoc.version}</version>
    </dependency>

    <dependency>
        <groupId>io.micronaut.data</groupId>
        <artifactId>micronaut-data-mongodb</artifactId>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver-reactivestreams</artifactId>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>io.micronaut.discovery</groupId>
        <artifactId>micronaut-discovery-client</artifactId>
    </dependency>

`

Environment Information

jdk : 17 kotlin version : 1.8.21 consul server version : 1.15.4

Example Application

No response

Version

4.0.1

Note : When i try to use spring boot with consul server with same configuration , is working fine .

070hm commented 1 year ago

I think the error when using Kotlin , i change the build tool from maven to kotlin gradle , show me this error

03:41:24.044 [default-nioEventLoopGroup-1-5] ERROR i.m.d.registration.AutoRegistration - Error occurred during service registration with Consul: Error encoding object [io.micronaut.discovery.consul.client.v1.NewServiceEntry@999f4017] to JSON: Error loading BeanIntrospection for type [class java.net.Inet4Address]: failed to access class java.net.InetAddress$InetAddressHolder from class com.example.$java_net_Inet4Address$Introspection (java.net.InetAddress$InetAddressHolder is in module java.base of loader 'bootstrap'; com.example.$java_net_Inet4Address$Introspection is in unnamed module of loader 'app')
io.micronaut.http.codec.CodecException: Error encoding object [io.micronaut.discovery.consul.client.v1.NewServiceEntry@999f4017] to JSON: Error loading BeanIntrospection for type [class java.net.Inet4Address]: failed to access class java.net.InetAddress$InetAddressHolder from class com.example.$java_net_Inet4Address$Introspection (java.net.InetAddress$InetAddressHolder is in module java.base of loader 'bootstrap'; com.example.$java_net_Inet4Address$Introspection is in unnamed module of loader 'app')
    at io.micronaut.json.body.JsonMessageHandler.decorateWrite(JsonMessageHandler.java:127)
    at io.micronaut.json.body.JsonMessageHandler.writeTo(JsonMessageHandler.java:136)
    at io.micronaut.http.body.MessageBodyWriter.writeTo(MessageBodyWriter.java:138)
    at io.micronaut.http.netty.body.NettyJsonHandler.writeTo(NettyJsonHandler.java:133)
    at io.micronaut.http.body.DynamicMessageBodyWriter.writeTo(DynamicMessageBodyWriter.java:79)
    at io.micronaut.http.client.netty.DefaultHttpClient.buildNettyRequest(DefaultHttpClient.java:1352)
    at io.micronaut.http.client.netty.DefaultHttpClient.sendRequestThroughChannel(DefaultHttpClient.java:1483)
    at io.micronaut.http.client.netty.DefaultHttpClient.lambda$exchangeImpl$26(DefaultHttpClient.java:1131)
    at reactor.core.publisher.FluxCreate.subscribe(FluxCreate.java:95)
    at reactor.core.publisher.Flux.subscribe(Flux.java:8773)
    at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:195)
    at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)
    at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:82)
    at io.micronaut.http.client.netty.CancellableMonoSink.tryForward(CancellableMonoSink.java:69)
    at io.micronaut.http.client.netty.CancellableMonoSink.tryEmitValue(CancellableMonoSink.java:86)
    at io.micronaut.http.client.netty.ConnectionManager$Pool$ConnectionHolder.emitPoolHandle(ConnectionManager.java:1142)
    at io.micronaut.http.client.netty.ConnectionManager$Pool$Http1ConnectionHolder.dispatch0(ConnectionManager.java:1291)
    at io.micronaut.http.client.netty.ConnectionManager$Pool$ConnectionHolder.dispatch(ConnectionManager.java:1165)
    at io.micronaut.http.client.netty.PoolResizer.dispatchSafe(PoolResizer.java:169)
    at io.micronaut.http.client.netty.PoolResizer.doSomeWork(PoolResizer.java:115)
    at io.micronaut.http.client.netty.PoolResizer.dirty(PoolResizer.java:77)
    at io.micronaut.http.client.netty.PoolResizer.onNewConnectionEstablished1(PoolResizer.java:208)
    at io.micronaut.http.client.netty.ConnectionManager$Pool$Http1ConnectionHolder.init(ConnectionManager.java:1231)
    at io.micronaut.http.client.netty.ConnectionManager$Pool$2$1.channelActive(ConnectionManager.java:1040)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:262)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:238)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelActive(AbstractChannelHandlerContext.java:231)
    at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelActive(CombinedChannelDuplexHandler.java:412)
    at io.netty.channel.ChannelInboundHandlerAdapter.channelActive(ChannelInboundHandlerAdapter.java:69)
    at io.netty.channel.CombinedChannelDuplexHandler.channelActive(CombinedChannelDuplexHandler.java:211)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:260)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:238)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelActive(AbstractChannelHandlerContext.java:231)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelActive(DefaultChannelPipeline.java:1398)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:258)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelActive(AbstractChannelHandlerContext.java:238)
    at io.netty.channel.DefaultChannelPipeline.fireChannelActive(DefaultChannelPipeline.java:895)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:305)
    at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:335)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: io.micronaut.serde.exceptions.SerdeException: Error loading BeanIntrospection for type [class java.net.Inet4Address]: failed to access class java.net.InetAddress$InetAddressHolder from class com.example.$java_net_Inet4Address$Introspection (java.net.InetAddress$InetAddressHolder is in module java.base of loader 'bootstrap'; com.example.$java_net_Inet4Address$Introspection is in unnamed module of loader 'app')
    at io.micronaut.serde.support.serializers.ObjectSerializer$4.tryToFindSerializer(ObjectSerializer.java:218)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.lambda$getSerializer$0(ObjectSerializer.java:280)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.getSerializer(ObjectSerializer.java:278)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.serialize(ObjectSerializer.java:245)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.serialize(ObjectSerializer.java:245)
    at io.micronaut.serde.support.serializers.OptionalSerializer$1.serialize(OptionalSerializer.java:63)
    at io.micronaut.serde.support.serializers.OptionalSerializer$1.serialize(OptionalSerializer.java:51)
    at io.micronaut.serde.support.serializers.CustomizedObjectSerializer.serialize(CustomizedObjectSerializer.java:132)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.serialize(ObjectSerializer.java:245)
    at io.micronaut.serde.jackson.JacksonJsonMapper.writeValue(JacksonJsonMapper.java:114)
    at io.micronaut.serde.jackson.JacksonJsonMapper.writeValue(JacksonJsonMapper.java:193)
    at io.micronaut.json.body.JsonMessageHandler.writeTo(JsonMessageHandler.java:134)
    ... 45 common frames omitted
Caused by: io.micronaut.core.beans.exceptions.IntrospectionException: Error loading BeanIntrospection for type [class java.net.Inet4Address]: failed to access class java.net.InetAddress$InetAddressHolder from class com.example.$java_net_Inet4Address$Introspection (java.net.InetAddress$InetAddressHolder is in module java.base of loader 'bootstrap'; com.example.$java_net_Inet4Address$Introspection is in unnamed module of loader 'app')
    at io.micronaut.core.beans.DefaultBeanIntrospector.findIntrospection(DefaultBeanIntrospector.java:104)
    at io.micronaut.serde.support.DefaultSerdeIntrospections.getSerializableIntrospection(DefaultSerdeIntrospections.java:77)
    at io.micronaut.serde.support.serializers.SerBean.<init>(SerBean.java:107)
    at io.micronaut.serde.support.serializers.ObjectSerializer.create(ObjectSerializer.java:202)
    at io.micronaut.serde.support.serializers.ObjectSerializer.lambda$getSerBean$0(ObjectSerializer.java:193)
    at io.micronaut.core.util.SupplierUtil$2.get(SupplierUtil.java:79)
    at io.micronaut.serde.support.serializers.ObjectSerializer.getSerBean(ObjectSerializer.java:194)
    at io.micronaut.serde.support.serializers.ObjectSerializer.createSpecificInternal(ObjectSerializer.java:93)
    at io.micronaut.serde.support.serializers.ObjectSerializer.createSpecific(ObjectSerializer.java:86)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.tryToFindSerializer(ObjectSerializer.java:296)
    at io.micronaut.serde.support.serializers.ObjectSerializer$4.tryToFindSerializer(ObjectSerializer.java:216)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.lambda$getSerializer$0(ObjectSerializer.java:280)
    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.getSerializer(ObjectSerializer.java:278)
    at io.micronaut.serde.support.serializers.ObjectSerializer$RuntimeTypeSerializer.isEmpty(ObjectSerializer.java:256)
    at io.micronaut.serde.support.serializers.OptionalSerializer$1.isEmpty(OptionalSerializer.java:77)
    at io.micronaut.serde.support.serializers.OptionalSerializer$1.isEmpty(OptionalSerializer.java:51)
    at io.micronaut.serde.support.serializers.CustomizedObjectSerializer.serialize(CustomizedObjectSerializer.java:100)
    ... 49 common frames omitted
Caused by: java.lang.IllegalAccessError: failed to access class java.net.InetAddress$InetAddressHolder from class com.example.$java_net_Inet4Address$Introspection (java.net.InetAddress$InetAddressHolder is in module java.base of loader 'bootstrap'; com.example.$java_net_Inet4Address$Introspection is in unnamed module of loader 'app')
    at com.example.$java_net_Inet4Address$Introspection.<clinit>(Unknown Source)
    at com.example.$Application$IntrospectionRef0.load(Unknown Source)
    at io.micronaut.core.beans.DefaultBeanIntrospector.lambda$findIntrospection$0(DefaultBeanIntrospector.java:95)
    at java.base/java.util.Optional.map(Optional.java:260)
    at io.micronaut.core.beans.DefaultBeanIntrospector.findIntrospection(DefaultBeanIntrospector.java:91)
    ... 66 common frames omitted
peh commented 1 year ago

I can reproduce this on latest micronaut with latest discovery client but a slightly different exception io.micronaut.aop.exceptions.UnimplementedAdviceException: All possible Introduction advise exhausted and no implementation found for method: Publisher register(ConsulNewServiceEntry entry)

070hm commented 11 months ago

I can reproduce this on latest micronaut with latest discovery client but a slightly different exception io.micronaut.aop.exceptions.UnimplementedAdviceException: All possible Introduction advise exhausted and no implementation found for method: Publisher register(ConsulNewServiceEntry entry)

yes after i update to latest version i get same error

05:47:10.749 [main] ERROR i.m.d.registration.AutoRegistration - Error occurred during service registration with Consul: All possible Introduction advise exhausted and no implementation found for method: Publisher register(ConsulNewServiceEntry entry)
io.micronaut.aop.exceptions.UnimplementedAdviceException: All possible Introduction advise exhausted and no implementation found for method: Publisher register(ConsulNewServiceEntry entry)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:126)
    at io.micronaut.aop.chain.AbstractInterceptorChain.proceed(AbstractInterceptorChain.java:171)
    at io.micronaut.aop.chain.InterceptorChain.proceed(InterceptorChain.java:46)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResultAsPublisher(PublisherInterceptedMethod.java:70)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResult(PublisherInterceptedMethod.java:87)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResult(PublisherInterceptedMethod.java:39)
    at io.micronaut.retry.intercept.DefaultRetryInterceptor.retrySync(DefaultRetryInterceptor.java:228)
    at io.micronaut.retry.intercept.DefaultRetryInterceptor.intercept(DefaultRetryInterceptor.java:129)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResultAsPublisher(PublisherInterceptedMethod.java:65)
    at io.micronaut.validation.ValidatingInterceptor.intercept(ValidatingInterceptor.java:129)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.discovery.consul.client.v1.AbstractConsulClient$Intercepted.register(Unknown Source)
    at io.micronaut.discovery.consul.registration.ConsulAutoRegistration.register(ConsulAutoRegistration.java:169)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:58)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:38)
    at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:266)
    at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:226)
    at io.micronaut.http.server.netty.discovery.NettyServiceDiscovery.onStart(NettyServiceDiscovery.java:51)
    at io.micronaut.http.server.netty.discovery.$NettyServiceDiscovery$Definition$Exec.dispatch(Unknown Source)
    at io.micronaut.context.AbstractExecutableMethodsDefinition$DispatchedExecutableMethod.invoke(AbstractExecutableMethodsDefinition.java:442)
    at io.micronaut.context.DefaultBeanContext$BeanExecutionHandle.invoke(DefaultBeanContext.java:3841)
    at io.micronaut.aop.chain.AdapterIntroduction.intercept(AdapterIntroduction.java:84)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.http.server.netty.discovery.NettyServiceDiscovery$ApplicationEventListener$onStart1$Intercepted.onApplicationEvent(Unknown Source)
    at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:266)
    at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:226)
    at io.micronaut.http.server.netty.NettyHttpServer.fireStartupEvents(NettyHttpServer.java:602)
    at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:304)
    at io.micronaut.http.server.netty.NettyHttpServer.start(NettyHttpServer.java:104)
    at io.micronaut.runtime.Micronaut.start(Micronaut.java:79)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:322)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:297)
    at com.yimdeek.ApplicationKt.main(Application.kt:6)
krickert commented 10 months ago

I'm getting this same error. Looks like consul registration is failing now under micronaut. I have two projects that one can run to recreate this and it was working under previous versions of micronaut.

If there's any sample code that auto-registers a grpc client, I'll check that out and see what I did wrong.

krickert commented 10 months ago

https://github.com/krickert/search_indexer/tree/master/services/pipeline-services

This has two examples of micronaut projects that cause this to fail. I'm following the exact same directions as before.

Here's my micronaut config:

micronaut:
  application:
    name: vectorizer
consul:
  client:
    defaultZone: ${CONSUL_HOST:localhost}:${CONSUL_PORT:8500}
    registration:
      enabled: true
grpc:
  server:
    port: 50052

And this is the output I'm seeing:

 __  __ _                                  _   
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_ 
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_ 
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|
14:40:49.913 [main] INFO  i.m.context.DefaultBeanContext - Reading bootstrap environment configuration
14:40:53.592 [main] INFO  ai.djl.pytorch.engine.PtEngine - PyTorch graph executor optimizer is enabled, this may impact your inference latency and throughput. See: https://docs.djl.ai/docs/development/inference_performance_optimization.html#graph-executor-optimization
14:40:53.594 [main] INFO  ai.djl.pytorch.engine.PtEngine - Number of inter-op threads is 6
14:40:53.594 [main] INFO  ai.djl.pytorch.engine.PtEngine - Number of intra-op threads is 6
14:40:53.768 [main] INFO  ai.djl.util.Platform - Found matching platform from: jar:file:/home/krickert/.m2/repository/ai/djl/huggingface/tokenizers/0.26.0/tokenizers-0.26.0.jar!/native/lib/tokenizers.properties
14:41:03.035 [main] ERROR i.m.d.registration.AutoRegistration - Error occurred during service registration with Consul: All possible Introduction advise exhausted and no implementation found for method: Publisher register(ConsulNewServiceEntry entry)
io.micronaut.aop.exceptions.UnimplementedAdviceException: All possible Introduction advise exhausted and no implementation found for method: Publisher register(ConsulNewServiceEntry entry)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:126)
    at io.micronaut.aop.chain.AbstractInterceptorChain.proceed(AbstractInterceptorChain.java:171)
    at io.micronaut.aop.chain.InterceptorChain.proceed(InterceptorChain.java:46)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResultAsPublisher(PublisherInterceptedMethod.java:70)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResult(PublisherInterceptedMethod.java:87)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResult(PublisherInterceptedMethod.java:39)
    at io.micronaut.retry.intercept.DefaultRetryInterceptor.retrySync(DefaultRetryInterceptor.java:228)
    at io.micronaut.retry.intercept.DefaultRetryInterceptor.intercept(DefaultRetryInterceptor.java:129)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResultAsPublisher(PublisherInterceptedMethod.java:65)
    at io.micronaut.validation.ValidatingInterceptor.intercept(ValidatingInterceptor.java:129)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.discovery.consul.client.v1.AbstractConsulClient$Intercepted.register(Unknown Source)
    at io.micronaut.discovery.consul.registration.ConsulAutoRegistration.register(ConsulAutoRegistration.java:169)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:58)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:38)
    at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:266)
    at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:226)
    at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1815)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.lambda$start$1(GrpcEmbeddedServer.java:191)
    at java.base/java.util.Optional.ifPresent(Optional.java:178)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.start(GrpcEmbeddedServer.java:171)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.start(GrpcEmbeddedServer.java:63)
    at io.micronaut.runtime.Micronaut.start(Micronaut.java:79)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:322)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:308)
    at com.krickert.search.service.vectorizer.Application.main(Application.java:27)

14:41:12.044 [main] ERROR i.m.d.registration.AutoRegistration - Error occurred de-registering service [vectorizer] with Consul: All possible Introduction advise exhausted and no implementation found for method: Publisher deregister(String service)
io.micronaut.aop.exceptions.UnimplementedAdviceException: All possible Introduction advise exhausted and no implementation found for method: Publisher deregister(String service)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:126)
    at io.micronaut.aop.chain.AbstractInterceptorChain.proceed(AbstractInterceptorChain.java:171)
    at io.micronaut.aop.chain.InterceptorChain.proceed(InterceptorChain.java:46)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResultAsPublisher(PublisherInterceptedMethod.java:70)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResult(PublisherInterceptedMethod.java:87)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResult(PublisherInterceptedMethod.java:39)
    at io.micronaut.retry.intercept.DefaultRetryInterceptor.retrySync(DefaultRetryInterceptor.java:228)
    at io.micronaut.retry.intercept.DefaultRetryInterceptor.intercept(DefaultRetryInterceptor.java:129)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.aop.internal.intercepted.PublisherInterceptedMethod.interceptResultAsPublisher(PublisherInterceptedMethod.java:65)
    at io.micronaut.validation.ValidatingInterceptor.intercept(ValidatingInterceptor.java:129)
    at io.micronaut.aop.chain.MethodInterceptorChain.proceed(MethodInterceptorChain.java:137)
    at io.micronaut.discovery.consul.client.v1.AbstractConsulClient$Intercepted.deregister(Unknown Source)
    at io.micronaut.discovery.consul.registration.ConsulAutoRegistration.deregister(ConsulAutoRegistration.java:145)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:61)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:38)
    at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:266)
    at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:226)
    at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1815)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.stop(GrpcEmbeddedServer.java:207)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.stop(GrpcEmbeddedServer.java:63)
    at io.micronaut.discovery.client.registration.DiscoveryServiceAutoRegistration$1.onError(DiscoveryServiceAutoRegistration.java:86)
    at reactor.core.publisher.StrictSubscriber.onError(StrictSubscriber.java:106)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:843)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:609)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:589)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.onError(FluxFlatMap.java:452)
    at io.micronaut.core.async.publisher.Publishers$JustThrowPublisher$1.request(Publishers.java:643)
    at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:371)
    at io.micronaut.core.async.publisher.Publishers$JustThrowPublisher.subscribe(Publishers.java:634)
    at reactor.core.publisher.FluxSource.subscribe(FluxSource.java:74)
    at reactor.core.publisher.Flux.subscribe(Flux.java:8773)
    at io.micronaut.discovery.client.registration.DiscoveryServiceAutoRegistration.performRegistration(DiscoveryServiceAutoRegistration.java:66)
    at io.micronaut.discovery.consul.registration.ConsulAutoRegistration.register(ConsulAutoRegistration.java:170)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:58)
    at io.micronaut.discovery.registration.AutoRegistration.onApplicationEvent(AutoRegistration.java:38)
    at io.micronaut.context.event.ApplicationEventPublisherFactory.notifyEventListeners(ApplicationEventPublisherFactory.java:266)
    at io.micronaut.context.event.ApplicationEventPublisherFactory$2.publishEvent(ApplicationEventPublisherFactory.java:226)
    at io.micronaut.context.DefaultBeanContext.publishEvent(DefaultBeanContext.java:1815)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.lambda$start$1(GrpcEmbeddedServer.java:191)
    at java.base/java.util.Optional.ifPresent(Optional.java:178)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.start(GrpcEmbeddedServer.java:171)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.start(GrpcEmbeddedServer.java:63)
    at io.micronaut.runtime.Micronaut.start(Micronaut.java:79)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:322)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:308)
    at com.krickert.search.service.vectorizer.Application.main(Application.java:27)
    Suppressed: java.lang.Exception: #block terminated with an error
        at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:103)
        at reactor.core.publisher.Flux.blockFirst(Flux.java:2704)
        at io.micronaut.discovery.client.registration.DiscoveryServiceAutoRegistration.performDeregistration(DiscoveryServiceAutoRegistration.java:133)
        at io.micronaut.discovery.consul.registration.ConsulAutoRegistration.deregister(ConsulAutoRegistration.java:147)
        ... 33 common frames omitted
14:41:12.061 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Already started
java.lang.IllegalStateException: Already started
    at com.google.common.base.Preconditions.checkState(Preconditions.java:512)
    at io.grpc.internal.ServerImpl.start(ServerImpl.java:180)
    at io.grpc.internal.ServerImpl.start(ServerImpl.java:94)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.start(GrpcEmbeddedServer.java:169)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.getPort(GrpcEmbeddedServer.java:130)
    at io.micronaut.grpc.server.GrpcEmbeddedServer.getURI(GrpcEmbeddedServer.java:161)
    at io.micronaut.runtime.server.EmbeddedServer.getContextURI(EmbeddedServer.java:62)
    at io.micronaut.runtime.Micronaut.start(Micronaut.java:93)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:322)
    at io.micronaut.runtime.Micronaut.run(Micronaut.java:308)
    at com.krickert.search.service.vectorizer.Application.main(Application.java:27)

Process finished with exit code 1

I'll try to make a standalone one. Confused about how to fix this.

afajunior commented 8 months ago

Does anyone know what the potential fix might be? I also receive this issue, but I have no idea how to fix it.

krickert commented 8 months ago

I don't remember what the dependency was, but I had to include another libarary in my mvn buld. Sorry this isnt helping - can you share a runnable project?

afajunior commented 8 months ago

Hi @krickert, thank you for your reply

Sure, you can look at my repo here: https://github.com/afajunior/salescar

There is a subproject call "veiculo-service", just enable the consul at application.yml. The consul docker is in docker-compose.yml in the root

jeremyg484 commented 7 months ago

This error appears to be caused by not having the Micronaut http client configured correctly on the class path.

For example, in the sample app @afajunior provided, changing the scope of the dependency at this line in build.gradle to implementation allows the client to connect as expected.

That it may have worked in prior versions without this is likely due to a correction we made to the BOM.

I will update the docs to show the needed dependency, and also look into potentially providing a better error message when things are not configured correctly.

070hm commented 6 months ago

This error appears to be caused by not having the Micronaut http client configured correctly on the class path.

For example, in the sample app @afajunior provided, changing the scope of the dependency at this line in build.gradle to implementation allows the client to connect as expected.

That it may have worked in prior versions without this is likely due to a correction we made to the BOM.

I will update the docs to show the needed dependency, and also look into potentially providing a better error message when things are not configured correctly.

Thanks bro,