Temporal-sdk java issue with protobuf versioning

Hi all, I have been running into an issue with protobuf on my classpath during runtime. Specifically, my gradle file has the following:

implementation("io.temporal:temporal-sdk:1.24.1")
implementation("io.temporal:temporal-kotlin:1.24.1")

During runtime, we are getting this error:

java.lang.NoSuchMethodError: 'boolean com.google.protobuf.Value.hasNullValue()'

Taking a closer look, the protobuf library doesn’t have this method until version 3.15. Using the debugger and reflection I was able to figure out where it was getting this class from to see why it was pulling an older one and I found it was:

/Users/sg/.gradle/caches/modules-2/files-2.1/io.temporal/temporal-serviceclient/1.24.1/c8d53b8b35e8c1c14941aa0509b01570be21605a/temporal-serviceclient-1.24.1.jar

So it seems like com.google.protobuf.Value is included within that jar which I was able to verify locally and on maven as well. Is there something wrong with the way that I am depending on this? I want to use a newer version of protobuf since it is required for google cloud. I found the temporal-shaded SDK but that says not to use it unless a older version of these libraries is required. Thanks so much!

1 Like

Additionally, just for science I tried out the temporal-shaded dependency instead. While it shades the problematic com.google.protobuf dependencies it adds classes that are not in temporal-sdk. I am not sure why the class list is not the exact same with some shaded. Specifically, it is adding:

class com.google.longrunning.GetOperationRequest

Which is incompatible with google SDK clients that use protobuf lite.

Also, then I took a closer look at the Java SDK. And the protoVersion chosen in the build.gradle is set to 3.22, but I don’t see the expected methods on the classes that should be there in the exported client JAR. The exported JAR seems to expose a version older than that.

Hi again, wanted to point out one more thing I discovered. While building the temporal-sdk locally, I realized that between version 1.23.1 and 1.23.2, the problematic com.google.api export was added. The build.gradle within the temporal-serviceclient package had no changes so I am not sure if it was intentional. 1.23.2 was released only a few months ago and I didn’t see anything in the release notes so it might have been inadvertent.

+1 on this. Faced the same problem.

Release 1.23.2 change directly includes some protobuf files, leading to classpath conflicts

Here is a related issue on github

Yes this is because these google proto APIs were added to the main Temporal API

Until these are removed the Java SDK will need to manually filter them out. That is tracked by this issue and should be included in the next Java SDK release