Connecting to AxonServer node [localhost:8124] failed

Im new to axon server. Im getting the following error while invoking the spring boot application when axon server is running.

2024-09-06T19:53:59.388+05:30 WARN 15452 — [user-service] [ main] i.a.a.c.impl.AxonServerManagedChannel : Connecting to AxonServer node [localhost:8124] failed.

io.grpc.StatusRuntimeException: UNKNOWN
at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:271) ~[grpc-stub-1.50.2.jar:1.50.2]
at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:252) ~[grpc-stub-1.50.2.jar:1.50.2]
at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:165) ~[grpc-stub-1.50.2.jar:1.50.2]
at io.axoniq.axonserver.grpc.control.PlatformServiceGrpc$PlatformServiceBlockingStub.getPlatformServer(PlatformServiceGrpc.java:250) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.axoniq.axonserver.connector.impl.AxonServerManagedChannel.connectChannel(AxonServerManagedChannel.java:115) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.axoniq.axonserver.connector.impl.AxonServerManagedChannel.createConnection(AxonServerManagedChannel.java:335) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.axoniq.axonserver.connector.impl.AxonServerManagedChannel.ensureConnected(AxonServerManagedChannel.java:300) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.axoniq.axonserver.connector.impl.AxonServerManagedChannel.getState(AxonServerManagedChannel.java:227) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.axoniq.axonserver.connector.impl.ContextConnection.ensureConnected(ContextConnection.java:221) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.axoniq.axonserver.connector.impl.ContextConnection.connect(ContextConnection.java:158) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.axoniq.axonserver.connector.AxonServerConnectionFactory.connect(AxonServerConnectionFactory.java:166) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at org.axonframework.axonserver.connector.AxonServerConnectionManager.createConnection(AxonServerConnectionManager.java:130) ~[axon-server-connector-4.7.2.jar:4.7.2]
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) ~[na:na]
at org.axonframework.axonserver.connector.AxonServerConnectionManager.getConnection(AxonServerConnectionManager.java:126) ~[axon-server-connector-4.7.2.jar:4.7.2]
at org.axonframework.axonserver.connector.command.AxonServerCommandBus.subscribe(AxonServerCommandBus.java:213) ~[axon-server-connector-4.7.2.jar:4.7.2]
at org.axonframework.modelling.command.AggregateAnnotationCommandHandler.lambda$null$0(AggregateAnnotationCommandHandler.java:138) ~[axon-modelling-4.7.2.jar:4.7.2]
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1707) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) ~[na:na]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[na:na]
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276) ~[na:na]
at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1850) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[na:na]
at org.axonframework.modelling.command.AggregateAnnotationCommandHandler.subscribe(AggregateAnnotationCommandHandler.java:141) ~[axon-modelling-4.7.2.jar:4.7.2]
at org.axonframework.config.AggregateConfigurer.lambda$initialize$34(AggregateConfigurer.java:453) ~[axon-configuration-4.7.2.jar:4.7.2]
at org.axonframework.config.LifecycleOperations.lambda$onStart$0(LifecycleOperations.java:62) ~[axon-configuration-4.7.2.jar:4.7.2]
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[na:na]
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[na:na]
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[na:na]
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[na:na]
at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:662) ~[na:na]
at org.axonframework.config.DefaultConfigurer.invokeLifecycleHandlers(DefaultConfigurer.java:883) ~[axon-configuration-4.7.2.jar:4.7.2]
at org.axonframework.config.DefaultConfigurer.invokeStartHandlers(DefaultConfigurer.java:829) ~[axon-configuration-4.7.2.jar:4.7.2]
at org.axonframework.config.DefaultConfigurer$ConfigurationImpl.start(DefaultConfigurer.java:980) ~[axon-configuration-4.7.2.jar:4.7.2]
at org.axonframework.spring.config.SpringAxonConfiguration.start(SpringAxonConfiguration.java:76) ~[axon-spring-4.7.2.jar:4.7.2]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:285) ~[spring-context-6.1.11.jar:6.1.11]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:469) ~[spring-context-6.1.11.jar:6.1.11]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:257) ~[spring-context-6.1.11.jar:6.1.11]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:202) ~[spring-context-6.1.11.jar:6.1.11]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:990) ~[spring-context-6.1.11.jar:6.1.11]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:628) ~[spring-context-6.1.11.jar:6.1.11]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363) ~[spring-boot-3.3.2.jar:3.3.2]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352) ~[spring-boot-3.3.2.jar:3.3.2]
at com.jupiter.user.UserApplication.main(UserApplication.java:25) ~[classes/:na]
Caused by: java.lang.UnsupportedOperationException: null
at io.grpc.netty.AbstractHttp2Headers.iterator(AbstractHttp2Headers.java:500) ~[grpc-netty-1.50.2.jar:1.50.2]
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:423) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:350) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onHeadersRead(Http2InboundFrameLogger.java:54) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader$2.processFragment(DefaultHttp2FrameReader.java:475) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:483) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:247) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:164) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:39) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:186) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:391) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:451) ~[netty-codec-http2-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:530) ~[netty-codec-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:469) ~[netty-codec-4.1.111.Final.jar:4.1.111.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.111.Final.jar:4.1.111.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994) ~[netty-common-4.1.111.Final.jar:4.1.111.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.111.Final.jar:4.1.111.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.111.Final.jar:4.1.111.Final]
at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]

2024-09-06T19:53:59.405+05:30 INFO 15452 — [user-service] [ main] i.a.a.c.impl.AxonServerManagedChannel : Failed to get connection to AxonServer. Scheduling a reconnect in 2000ms
2024-09-06T19:53:59.461+05:30 INFO 15452 — [user-service] [ main] i.a.a.c.impl.AxonServerManagedChannel : Requesting connection details from localhost:8124
2024-09-06T19:53:59.509+05:30 WARN 15452 — [user-service] [ main] i.a.a.c.impl.AxonServerManagedChannel : Connecting to AxonServer node [localhost:8124] failed: UNKNOWN
2024-09-06T19:53:59.509+05:30 INFO 15452 — [user-service] [ main] i.a.a.c.impl.AxonServerManagedChannel : Failed to get connection to AxonServer. Scheduling a reconnect in 2000ms
2024-09-06T19:53:59.523+05:30 INFO 15452 — [user-service] [ main] i.a.a.c.command.impl.CommandChannelImpl : CommandChannel for context ‘default’ connected, 0 command handlers registered
2024-09-06T19:53:59.531+05:30 INFO 15452 — [user-service] [ main] i.a.a.c.command.impl.CommandChannelImpl : Registered handler for command ‘com.jupiter.userservice.command.CreateUserCommand’ in context ‘default’
2024-09-06T19:53:59.540+05:30 DEBUG 15452 — [user-service] [ main] o.a.a.c.command.AxonServerCommandBus : Subscribing command with name [com.jupiter.userservice.command.RollbackUserCommand] to this distributed CommandBus. Expect similar logging on the local segment.
2024-09-06T19:53:59.541+05:30 DEBUG 15452 — [user-service] [ main] o.a.commandhandling.SimpleCommandBus : Subscribing command with name [com.jupiter.userservice.command.RollbackUserCommand]
2024-09-06T19:53:59.541+05:30 INFO 15452 — [user-service] [ main] i.a.a.c.command.impl.CommandChannelImpl : Registered handler for command ‘com.jupiter.userservice.command.RollbackUserCommand’ in context ‘default’
2024-09-06T19:53:59.542+05:30 DEBUG 15452 — [user-service] [ main] o.a.config.DefaultConfigurer : Entered start handler lifecycle phase [536870911]
2024-09-06T19:53:59.544+05:30 DEBUG 15452 — [user-service] [ main] o.a.config.DefaultConfigurer : Entered start handler lifecycle phase [1073741823]
2024-09-06T19:53:59.545+05:30 DEBUG 15452 — [user-service] [ main] org.axonframework.config.Component : Instantiated component [eventProcessorControlService]: org.axonframework.axonserver.connector.processor.EventProcessorControlService@7ba0c0e5
2024-09-06T19:53:59.549+05:30 DEBUG 15452 — [user-service] [ main] o.a.config.DefaultConfigurer : Entered start handler lifecycle phase [1073741833]
2024-09-06T19:53:59.556+05:30 DEBUG 15452 — [user-service] [ main] o.a.config.DefaultConfigurer : Finalized start sequence
2024-09-06T19:53:59.629+05:30 WARN 15452 — [user-service] [vice.handler]-0] o.a.e.TrackingEventProcessor : Fetch Segments for Processor ‘com.jupiter.userservice.handler’ failed: io.grpc.StatusRuntimeException: UNAVAILABLE. Preparing for retry in 1s

org.axonframework.eventsourcing.eventstore.EventStoreException: io.grpc.StatusRuntimeException: UNAVAILABLE
at org.axonframework.axonserver.connector.event.axon.AxonServerEventStore$AxonIQEventStorageEngine.createTailToken(AxonServerEventStore.java:606) ~[axon-server-connector-4.7.2.jar:4.7.2]
at org.axonframework.eventsourcing.eventstore.AbstractEventStore.createTailToken(AbstractEventStore.java:171) ~[axon-eventsourcing-4.7.2.jar:4.7.2]
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.lambda$run$1(TrackingEventProcessor.java:1218) ~[axon-messaging-4.7.2.jar:4.7.2]
at org.axonframework.common.transaction.TransactionManager.executeInTransaction(TransactionManager.java:47) ~[axon-messaging-4.7.2.jar:4.7.2]
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.run(TrackingEventProcessor.java:1216) ~[axon-messaging-4.7.2.jar:4.7.2]
at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]
Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: UNAVAILABLE
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[na:na]
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096) ~[na:na]
at org.axonframework.axonserver.connector.event.axon.AxonServerEventStore$AxonIQEventStorageEngine.createTailToken(AxonServerEventStore.java:600) ~[axon-server-connector-4.7.2.jar:4.7.2]
… 5 common frames omitted
Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE
at io.grpc.Status.asRuntimeException(Status.java:539) ~[grpc-api-1.50.2.jar:1.50.2]
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:487) ~[grpc-stub-1.50.2.jar:1.50.2]
at io.axoniq.axonserver.connector.impl.AxonServerManagedChannel$FailingCall.start(AxonServerManagedChannel.java:413) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.grpc.stub.ClientCalls.startCall(ClientCalls.java:341) ~[grpc-stub-1.50.2.jar:1.50.2]
at io.grpc.stub.ClientCalls.asyncUnaryRequestCall(ClientCalls.java:315) ~[grpc-stub-1.50.2.jar:1.50.2]
at io.grpc.stub.ClientCalls.asyncUnaryRequestCall(ClientCalls.java:303) ~[grpc-stub-1.50.2.jar:1.50.2]
at io.grpc.stub.ClientCalls.asyncUnaryCall(ClientCalls.java:76) ~[grpc-stub-1.50.2.jar:1.50.2]
at io.axoniq.axonserver.grpc.event.EventStoreGrpc$EventStoreStub.getFirstToken(EventStoreGrpc.java:670) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at io.axoniq.axonserver.connector.event.impl.EventChannelImpl.getFirstToken(EventChannelImpl.java:256) ~[axonserver-connector-java-4.6.3.jar:4.6.3]
at org.axonframework.axonserver.connector.event.axon.AxonServerEventStore$AxonIQEventStorageEngine.createTailToken(AxonServerEventStore.java:599) ~[axon-server-connector-4.7.2.jar:4.7.2]
… 5 common frames omitted

2024-09-06T19:54:00.632+05:30 INFO 15452 — [user-service] [vice.handler]-0] o.a.e.TrackingEventProcessor : Fetching Segments for Processor ‘com.jupiter.userservice.handler’ still failing: io.grpc.StatusRuntimeException: UNAVAILABLE. Preparing for retry in 2s
2024-09-06T19:54:01.516+05:30 INFO 15452 — [user-service] [PTOP-JTSMCQR0-1] i.a.a.c.impl.AxonServerManagedChannel : Requesting connection details from localhost:8124
2024-09-06T19:54:01.614+05:30 WARN 15452 — [user-service] [PTOP-JTSMCQR0-1] i.a.a.c.impl.AxonServerManagedChannel : Connecting to AxonServer node [localhost:8124] failed: UNKNOWN
2024-09-06T19:54:01.615+05:30 INFO 15452 — [user-service] [PTOP-JTSMCQR0-1] i.a.a.c.impl.AxonServerManagedChannel : Failed to get connection to AxonServer. Scheduling a reconnect in 2000ms
2024-09-06T19:54:02.637+05:30 INFO 15452 — [user-service] [vice.handler]-0] o.a.e.TrackingEventProcessor : Fetching Segments for Processor ‘com.jupiter.userservice.handler’ still failing: io.grpc.StatusRuntimeException: UNAVAILABLE. Preparing for retry in 4s
2024-09-06T19:54:03.663+05:30 INFO 15452 — [user-service] [PTOP-JTSMCQR0-0] i.a.a.c.impl.AxonServerManagedChannel : Requesting connection details from localhost:8124
2024-09-06T19:54:03.714+05:30 WARN 15452 — [user-service] [PTOP-JTSMCQR0-0] i.a.a.c.impl.AxonServerManagedChannel : Connecting to AxonServer node [localhost:8124] failed: UNKNOWN
2024-09-06T19:54:03.715+05:30 INFO 15452 — [user-service] [PTOP-JTSMCQR0-0] i.a.a.c.impl.AxonServerManagedChannel : Failed to get connection to AxonServer. Scheduling a reconnect in 2000ms

How did you start the AxonServer instance? The first time it starts you may need to initialize it. It’s usually just a matter of pushing a button in the UI (localhost:8024).

The error is resolved now. I was using axon 4.7.2 at spring boot 3.3.X. Resolved it by updating axon version to 4.9.X. And the application is running now with axon server.