NoSuchMethodError form Workflow Defined in Java Interface and Submitted From GoLang

Java:
@WorkflowInterface
public interface StatusUpdateWorkflow {

    @WorkflowMethod
    void updateStatus(ProtobufJob.JobRun job, long timestamp);
}

GoLang:

we, err := c.ExecuteWorkflow(context.Background(), workflowOptions, "StatusUpdateWorkflow", job, time.Now().UnixNano())

Error in GUI
Failure:

{
  "message": "com.google.gson.JsonParser.parseReader(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement;",
  "source": "JavaSDK",
  "stackTrace": "com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1340)\ncom.google.protobuf.util.JsonFormat$Parser.merge(JsonFormat.java:472)\nio.temporal.common.converter.ProtobufJsonPayloadConverter.fromData(ProtobufJsonPayloadConverter.java:100)\nio.temporal.common.converter.PayloadAndFailureDataConverter.fromPayload(PayloadAndFailureDataConverter.java:95)\nio.temporal.common.converter.DataConverter.arrayFromPayloads(DataConverter.java:172)\nio.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation.execute(POJOWorkflowImplementationFactory.java:309)\n",
  "encodedAttributes": null,
  "cause": null,
  "applicationFailureInfo": {
    "type": "java.lang.NoSuchMethodError",
    "nonRetryable": false,
    "details": null
  }
}

Stack Trace:
com.google.protobuf.util.JsonFormat$ParserImpl.merge(JsonFormat.java:1340)
com.google.protobuf.util.JsonFormat$Parser.merge(JsonFormat.java:472)
io.temporal.common.converter.ProtobufJsonPayloadConverter.fromData(ProtobufJsonPayloadConverter.java:100)
io.temporal.common.converter.PayloadAndFailureDataConverter.fromPayload(PayloadAndFailureDataConverter.java:95)
io.temporal.common.converter.DataConverter.arrayFromPayloads(DataConverter.java:172)
io.temporal.internal.sync.POJOWorkflowImplementationFactory$POJOWorkflowImplementation.execute(POJOWorkflowImplementationFactory.java:309)

My guess is that the protobuf library is either not included or of a wrong version.

1 Like

Thanks for your replay. I follwed the path and fixed it by tweaking pom.xml to enforce a higher version of gson to gson-2.10.1.jar

1 Like