Axonframework: The legacy GapAwareTrackingToken does not implement TrackingToken

Created on 3 Oct 2019  路  6Comments  路  Source: AxonFramework/AxonFramework

I'm migrating a axon 3.x application to axon 4.2.

I've added a dependency on the axon-legacy module (not standard in the spring starter, took a little search)

However, when the TrackingToken interface is not on the legacy tokens..

Hence some nice java.lang.ClassCastException: org.axonframework.eventsourcing.eventstore.GapAwareTrackingToken cannot be cast to org.axonframework.eventhandling.TrackingToken are preventing my upgrade to axon 4.2

Should Resolved Bug

Most helpful comment

Jackson..

All 6 comments

using the JDBC tokenstore

I'll have a look at this ASAP @JanGroot, thanks for filing this.
Additionally, what kind of Serializer are you using for the tokens?
The XStream of Jackson variant?

Jackson..

For reference: the full stacktrace:


java.lang.ClassCastException: org.axonframework.eventsourcing.eventstore.GapAwareTrackingToken cannot be cast to org.axonframework.eventhandling.TrackingToken
    at org.axonframework.eventhandling.tokenstore.AbstractTokenEntry.getToken(AbstractTokenEntry.java:117) ~[axon-messaging-4.2.jar:4.2]
    at org.axonframework.eventhandling.tokenstore.jdbc.JdbcTokenStore.claimToken(JdbcTokenStore.java:366) ~[axon-messaging-4.2.jar:4.2]
    at org.axonframework.eventhandling.tokenstore.jdbc.JdbcTokenStore.loadToken(JdbcTokenStore.java:392) ~[axon-messaging-4.2.jar:4.2]
    at org.axonframework.eventhandling.tokenstore.jdbc.JdbcTokenStore.lambda$fetchToken$12(JdbcTokenStore.java:182) ~[axon-messaging-4.2.jar:4.2]
    at org.axonframework.common.jdbc.JdbcUtils.executeQuery(JdbcUtils.java:61) ~[axon-messaging-4.2.jar:4.2]
    at org.axonframework.eventhandling.tokenstore.jdbc.JdbcTokenStore.fetchToken(JdbcTokenStore.java:181) ~[axon-messaging-4.2.jar:4.2]
    at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.lambda$run$1(TrackingEventProcessor.java:1135) ~[axon-messaging-4.2.jar:4.2]
    at org.axonframework.common.transaction.TransactionManager.executeInTransaction(TransactionManager.java:47) ~[axon-messaging-4.2.jar:4.2]
    at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.run(TrackingEventProcessor.java:1134) ~[axon-messaging-4.2.jar:4.2]
    at java.base/java.lang.Thread.run(Thread.java:844) [na:na]

The entry in the database:

INSERT INTO public.token_entry (processorname, segment, token, tokentype, timestamp, owner) VALUES ('notifications', 0, '{"gaps": [], "index": 1}', 'org.axonframework.eventsourcing.eventstore.GapAwareTrackingToken', null, null);

Thanks for that @JanGroot. I've just provided a PR, with test cases, to validate the legacy implementations of the GapAwareTrackingToken and GlobalSequenceTrackingToken can be serialized with the JacksonSerializer. This fix will be part of 4.2.1, which should be out relatively soon.
If it's obstructing you greatly, I'd recommend to pull my solution into your local project.

Closing this issue as PR #1231 resolved the problem.

Was this page helpful?
0 / 5 - 0 ratings