Class won't be found despite having been provided for initialisation at build time

64 Views Asked by At

The app runs in the JVM, this error only occurs when started native.

The error:

14:51:19.539 [DefaultDispatcher-worker-1] INFO  Application - Server is stopped. Releasing application resources...
Exception in thread "main" org.apache.kafka.common.config.ConfigException: Invalid value org.apache.kafka.common.serialization.Serdes$StringSerde for configuration default.key.serde: Class org.apache.kafka.common.serialization.Serdes$StringSerde could not be found.
    at org.apache.kafka.common.config.ConfigDef.parseType(ConfigDef.java:747)
    at org.apache.kafka.common.config.ConfigDef.parseValue(ConfigDef.java:493)

The buildArg:

--initialize-at-build-time=org.apache.kafka.common.serialization,org.apache.kafka.common.serialization.Serdes$StringSerde

The property:

kafka.streams.default.properties.default.key.serde:  "org.apache.kafka.common.serialization.Serdes$StringSerde"

Any idea why the class still won't be found?

1

There are 1 best solutions below

0
On

The solution was adding the following to the GraalVM reflection configuration:

  {
    "name" : "org.apache.kafka.common.serialization.Serdes",
    "queryAllDeclaredConstructors" : true,
    "queryAllPublicConstructors" : true,
    "queryAllDeclaredMethods" : true,
    "queryAllPublicMethods" : true,
    "allDeclaredClasses" : true,
    "allPublicClasses" : true
  }