Handling Event using TrackingEventProcessor gives UnknownSerializedType Event

I am creating an application which only listens to the events from Axon server. I am following this process. Inside:

TrackedEventProcessor.processBatch()

TrackedEventMessage<?> firstMessage = (TrackedEventMessage)eventStream.nextAvailable();

I get this response:

GenericTrackedDomainEventMessage{payload={org.axonframework.serialization.UnknownSerializedType@24f76adb}, metadata={'traceId'->'d80d2dcf-c687-43a1-affa-69ba0989f420', 'correlationId'->'d80d2dcf-c687-43a1-affa-69ba0989f420'}, messageIdentifier='59809810-9d75-49eb-a65a-e47dfebf08ad', timestamp='2023-02-27T02:55:39.507Z', aggregateType='MyAggregate', aggregateIdentifier='d68419e4-2295-4149-b047-86f14f29a800', sequenceNumber=0, trackingToken={IndexTrackingToken{globalIndex=0}}}

I assume that because of UnknownSerializedType payload I am not able to handle the event. Please help me to fix this.

In another case where CommandGateway and EventHandler are in the same application this event is handled perfectly.

Could it be that the class, used to create the event, is not on the classpath in the other application? Typically when you want to split up, there would be an API module with all the message classes. This makes sure the right classes are available.

Thanks for the help. It works now.