Jackson deserialization issue with Kotlin and data classes

Offen
#270 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
42/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
java, kotlin
Bereich
backend, cloud

Rechercherichtung

Beginne mit build.gradle.kts und vergleiche die verwendete Dependency-Konfiguration mit Azurite mit der in Azure verwendeten. Verfolge, wie der durable task data converter für bereitgestellte Kotlin-Workloads konfiguriert ist; als erledigt gilt die Aufgabe, wenn OrchestratorInput und ähnliche Kotlin-Datenklassen in Azure ohne Standardkonstruktorwerte deserialisiert werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Needs: Triage :mag:

I have a simple durable orchestration function written in Kotlin who's input type is

data class OrchestratorInput(val value: String)

When I run my orchestration, it fails to deserialize JSON text into an instance of OrchestratorInput, probably because data classes in Kotlin does not have any no-arg constructor unless I assign default values to all fields of the class. The output of the orchestration is shown below, containing the error message:

{
  "name": "OrchestrationFunction",
  "instanceId": "f340b4b5-b04d-43a0-bd83-40a12ab419ec",
  "runtimeStatus": "Failed",
  "input": {
    "value": "hello, world!"
  },
  "customStatus": "",
  "output": "com.microsoft.durabletask.DataConverter$DataConverterException: Failed to deserialize the JSON text to org.example.OrchestratorInput. Detailed error message: Cannot construct instance of `org.example.OrchestratorInput` (although at least one Creator exists): cannot deserialize from Object value (no delegate- or property-based Creator)\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]",
  "createdTime": "2026-03-10T11:31:29Z",
  "lastUpdatedTime": "2026-03-10T11:31:39Z"
}

Adding jackson-module-kotlin to build.gradle.kts did not help, although it helped when running the orchestration locally with Azurite

implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.21.1")

For some reason the module is not picked up when running in Azure. Is there any way to fix this? Now I'm forced to assign default values to every field of every data class used as input or output of orchestration- and activity functions, which makes the code very verbose.

Vorherrschende Sprache
Java
Sterne
29
Forks
18
Ø Merge
1 T. 10 Std.
Gemergte PRs (30 T.)
2

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/durabletask-java

Alle Issues in microsoft/durabletask-java

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.