Workflowservicestubs.newinstance() throwing method not found error

Hi Team,
I am intializing simple workers using the following code.

  1. WorkflowServiceStubs serviceStubs = WorkflowServiceStubs.newInstance();
  2.   WorkflowClient client = WorkflowClient.newInstance(serviceStubs);
  3. WorkerFactory factory = WorkerFactory.newInstance(client);
    4)Worker worker = factory.newWorker(Queue);
  4. worker.registerWorkflowImplementationTypes(Workflow.class);
  5. worker.registerActivitiesImplementations(new Activity());

but on running I am getting follwing exception when line 1 is getting executed:

Exception in thread “main” java.lang.NoSuchMethodError:;CLjava/lang/Object;)V
at io.grpc.Metadata$Key.validateName(
at io.grpc.Metadata$Key.(
at io.grpc.Metadata$Key.(
at io.grpc.Metadata$AsciiKey.(
at io.grpc.Metadata$AsciiKey.(
at io.grpc.Metadata$Key.of(
at io.grpc.Metadata$Key.of(
at io.temporal.serviceclient.WorkflowServiceStubsImpl.(
at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(
at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(
at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(

please help here

What server version and Java SDK version are you using?

I tried with both 1.3.0 and 1.4.0 java sdk versions.

I haven’t seen that issue personally, but very similar was reported here, (specific reply here), and ended up being a guava version issue. Worth looking into it on your end as well imo.

Hi @tihomir,
Thanks for the help as it looks like guava issue only. That issue is resolved by using the guava version 20. But now am getting ClassNotFoundException on the following execution :

Also to get rid of guava issue I had to move to older version of temporal.

Hi @tihomir,
I am getting the following error:
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
… 26 more

Something is going wrong JacksonJsonPayloadConverter class

Something is going wrong JacksonJsonPayloadConverter class

I’m pretty sure the class is fine. The error clearly indicates a missing dependency.

What framework are you adding the Temporal depends to? Maybe SpringBoot?
I would start with looking at your whole project dependencies
If you are using Maven

mvn dependency:tree

or with gradle

gradle -q dependencies 

and see what all libraries bring in guava libs and what versions there are. Then you probably need to add excludes to your depends to make sure only 1 version is loaded.

Hi @tihomir , I am using on both spring boot and drop wizard framework. I did the same and got the guava thing sorted out. But guava has removed a lot of things going forward in their journey and yet I managed to somehow balance between temporal guava dependency and drop wizard guava dependency. But after resolving that I got the error(The jacksonPayloadConverter issue) which is again some dependency issue only and now it seems due to complete backward incompatible guava and all it would not be possible to incorporate temporal within the time line I have been provided for this project.

The ‘Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase’ exception has nothing to do with guava. Also, Temporal support any recent guava versions. Temporal works fine with guava 10, while the current version is 31.
New release of java-sdk will not enforce guava version and will ask just for a range the following way: ‘[10.0,)!!31.0.1-jre’

To the ‘com.fasterxml.jackson.databind.ser.std.ToStringSerializerBase’.
I’m relatively sure that what’s going here is that you have
non-synchronized versions of com.fasterxml.jackson.datatype:jackson-datatype-jsr310 and
com.fasterxml.jackson.core:jackson-databind in your classpath.
com.fasterxml.jackson.datatype:jackson-datatype-jsr310 uses ToStringSerializerBase which is added in com.fasterxml.jackson.core:jackson-databind:2.10.

My best guess is that you likely excluded com.fasterxml.jackson.datatype:jackson-databind from temporal-sdk in favor of some older version that you supply or that it coming from another project?
If so, you have to exclude com.fasterxml.jackson.datatype:jackson-datatype-jsr310 and supply your classpath with a correct older version. When excluding transitive dependencies in favor of older versions, you should be excluding all tightly coupled modules and suppling older versions of them.

Generally, @tihomir advice is correct, the right way is to print dependency tree, grep for com.fasterxml.jackson and make sure that the versions are not mixed. Jackson library is quite sensitive with mismatching of its modules. Especially jackson-databind.
If you print the dependency tree, you most likely will find com.fasterxml.jackson.core:jackson-databind of an earlier version than 2.10 coming from somewhere.

We will rework our Jackson reference to using jackson-bom as it’s the best that we can do and it’s kinda state of the art approach like it’s described here: Automatically align Dependencies with Platforms and Gradle Module Metadata
So users will be able to use platforms to align versions across dependencies. At least, it will be fully supported from our, Temporal, side.

Hi @spikhalskiy, I agree that this is not guava issue as with the help of @tihomir I got guava issue sorted out but what I am pointing here is balancing one thing is making other dependency unbalanced. Also the thing with guava is that in there newer versions they have removed some of the functions so I am unable to try those versions as my application is using those functions. But as you and @tihomir pointed out I am trying with dependency tree.

@Pritam_Kumar2 thanks for bringing this up! As @spikhalskiy mentioned, we will make improvements regarding Jackson and depends integration with different frameworks.

Let us know what we can help with now to help unblock you. Could you share your SpringBoot and Dropwizard versions, so we can try to reproduce the issue and might be able to help with the investigation.