Hi,
We’re trying to move from 3.x to 4.x, but we have some issues with the tracking tokens.
We use MongoDB as the tokenstore in 3.x. This is in our AxonConfig
`
@Bean(name = “axonTokenStore”)
public TokenStore axonTokenStore(MongoClient client) {
return new MongoTokenStore(new DefaultMongoTemplate(client), new XStreamSerializer());
}
`
When we inspect the token stored in out token collection on MongoDB, the tokenType field has the value
org.axonframework.mongo.eventsourcing.eventstore.MongoTrackingToken
In 4.x we’ve kept things the same as much as possible for now, so no AxonServer yet, all events, tokens and sagas are stored in MongoDB, just like in our 3.x setup.
Our 4.x config looks like this (just a change to use the builders for the tokenstore)
`
@Bean(name = “axonTokenStore”)
public TokenStore axonTokenStore() {
Serializer tokenSerializer = XStreamSerializer.builder().build();
return MongoTokenStore.builder()
.serializer(tokenSerializer)
.mongoTemplate(defaultAxonMongoTemplate())
.build();
}
`
But when we start the application we get these errors:
2018-10-29 09:47:16.839 [EventProcessor[com.mn.stagportal.view.employee]-0] INFO o.a.e.TrackingEventProcessor - An error occurred while attempting to claim a token for segment: 0. Will retry later…
java.lang.ClassCastException: org.axonframework.serialization.UnknownSerializedType cannot be cast to org.axonframework.eventhandling.TrackingToken
at org.axonframework.eventhandling.tokenstore.AbstractTokenEntry.getToken(AbstractTokenEntry.java:117)
at org.axonframework.extensions.mongo.eventsourcing.tokenstore.MongoTokenStore.fetchToken(MongoTokenStore.java:147)
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.lambda$run$1(TrackingEventProcessor.java:726)
at org.axonframework.common.transaction.TransactionManager.executeInTransaction(TransactionManager.java:47)
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.run(TrackingEventProcessor.java:725)
at org.axonframework.eventhandling.TrackingEventProcessor$CountingRunnable.run(TrackingEventProcessor.java:588)
at java.lang.Thread.run(Thread.java:748)
So it appears that 3.x tracking tokens cannot be deserialized in 4.x…
After inspection (and a reset on a test system), we see that the value of tokenType in 4.x has changed to:
org.axonframework.extensions.mongo.eventsourcing.eventstore.MongoTrackingToken
Is there any guidance on how to migrate existing (mongo) tracking tokens? Is this a bug? Is this also an issue with JPA based token stores?
We really do not want to reset our whole application, but like to upgrade to 4.x and ‘just pick up where we left off’
Thanks,
Kind regards,
Danny