XStream not work java 17 + Axon 4.5.15 + Kafka 4.5.4 + mongodb 4.5


I am facing trying migrate my aplication to java 17 and Axon,
I get the follow error:

com.thoughtworks.xstream.converters.ConversionException: No converter available
---- Debugging information ----
message : No converter available
type : java.util.Collections$UnmodifiableMap
converter : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
message[1] : Unable to make field private static final long java.util.Collections$UnmodifiableMap.serialVersionUID accessible: module java.base does not “opens java.util” to unnamed module @4b5a5ed1
class : org.axonframework.extensions.kafka.eventhandling.consumer.streamable.KafkaTrackingToken
required-type : org.axonframework.extensions.kafka.eventhandling.consumer.streamable.KafkaTrackingToken
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /org.axonframework.extensions.kafka.eventhandling.consumer.streamable.KafkaTrackingToken/positions
line number : 2
version : 1.4.19

And my configuration as follow:

fun xStream(): XStream {
val xStream = XStream()
xStream.allowTypesByWildcard(arrayOf(“br.com.gubee.", "java.util.”))
return xStream

fun tokenStore(
        storageTemplate: MongoTemplate,
        xStream: XStream
): TokenStore {
    return MongoTokenStore.builder()

How to solve this kind of issue?

You need a wildcard for the classes to allow, so something like:

    public XStream xStream() {
        XStream xStream = new XStream();

        xStream.allowTypesByWildcard(new String[]{
        return xStream;

Hello Gerard,

I did exactly as you show, but when starting the application the error remains

    fun xStream(): XStream {
        val xStream = XStream()
        xStream.allowTypesByWildcard(arrayOf("br.com.gubee.**",  "java.util.**"))
        return xStream

It might be Java 17 related. Since we are probably moving to Jackson as default, moving to Jackson would probably be the easiest way to work around it.

I tried, but I get parser error because it was already saved in xml format in the database, how could this migration from one format to another be done?

I was under the impression you were still in the development phase. You could use upcasters through for cases like this. Alternatively, stick to Xtream with Java 17, and you likely need tricks like this.