# Workflowservicestubs.newinstance() throwing method not found error

**URL:** <https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [October 21, 2021, 12:52pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214 "2021-10-21T12:52:28Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pritam\_Kumar2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/pritam_kumar2/32/1342_2.png) [@Pritam\_Kumar2](https://community.temporal.io/u/Pritam_Kumar2)\
**Post date:** [October 21, 2021, 12:52pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/1 "2021-10-21T12:52:28Z")

</div>

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: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;)V  
at io.grpc.Metadata$Key.validateName(Metadata.java:742)  
at io.grpc.Metadata$Key.(Metadata.java:750)  
at io.grpc.Metadata$Key.(Metadata.java:668)  
at io.grpc.Metadata$AsciiKey.(Metadata.java:959)  
at io.grpc.Metadata$AsciiKey.(Metadata.java:954)  
at io.grpc.Metadata$Key.of(Metadata.java:705)  
at io.grpc.Metadata$Key.of(Metadata.java:701)  
at io.temporal.serviceclient.WorkflowServiceStubsImpl.(WorkflowServiceStubsImpl.java:56)  
at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(WorkflowServiceStubs.java:51)  
at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(WorkflowServiceStubs.java:41)  
at io.temporal.serviceclient.WorkflowServiceStubs.newInstance(WorkflowServiceStubs.java:36)

please help here

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [October 21, 2021, 1:33pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/2 "2021-10-21T13:33:38Z")

</div>

What server version and Java SDK version are you using?

---

<div class="post-metadata">

**Author:** ![Pritam\_Kumar2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/pritam_kumar2/32/1342_2.png) [@Pritam\_Kumar2](https://community.temporal.io/u/Pritam_Kumar2)\
**Post date:** [October 21, 2021, 2:28pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/3 "2021-10-21T14:28:00Z")

</div>

I tried with both 1.3.0 and 1.4.0 java sdk versions.

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [October 21, 2021, 2:32pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/4 "2021-10-21T14:32:58Z")

</div>

I haven’t seen that issue personally, but very similar was reported [here](https://community.temporal.io/t/optimize-history-records-for-a-workflow-with-all-local-activities/2819/12), (specific reply [here](https://community.temporal.io/t/optimize-history-records-for-a-workflow-with-all-local-activities/2819/17)), and ended up being a guava version issue. Worth looking into it on your end as well imo.

---

<div class="post-metadata">

**Author:** ![Pritam\_Kumar2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/pritam_kumar2/32/1342_2.png) [@Pritam\_Kumar2](https://community.temporal.io/u/Pritam_Kumar2)\
**Post date:** [October 22, 2021, 6:13am UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/5 "2021-10-22T06:13:24Z")

</div>

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 :  
DefaultDataConverter.getDefaultInstance();

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

---

<div class="post-metadata">

**Author:** ![Pritam\_Kumar2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/pritam_kumar2/32/1342_2.png) [@Pritam\_Kumar2](https://community.temporal.io/u/Pritam_Kumar2)\
**Post date:** [October 22, 2021, 8:33am UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/6 "2021-10-22T08:33:11Z")

</div>

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

Something is going wrong JacksonJsonPayloadConverter class

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [October 23, 2021, 5:44pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/7 "2021-10-23T17:44:22Z")

</div>

> Something is going wrong JacksonJsonPayloadConverter class

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

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [October 25, 2021, 3:13pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/8 "2021-10-25T15:13:20Z")

</div>

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

```auto
mvn dependency:tree

```

or with gradle

```auto
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.

---

<div class="post-metadata">

**Author:** ![Pritam\_Kumar2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/pritam_kumar2/32/1342_2.png) [@Pritam\_Kumar2](https://community.temporal.io/u/Pritam_Kumar2)\
**Post date:** [October 26, 2021, 4:17am UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/9 "2021-10-26T04:17:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![spikhalskiy](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/spikhalskiy/32/1250_2.png) [@spikhalskiy](https://community.temporal.io/u/spikhalskiy)\
**Post date:** [October 26, 2021, 6:19pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/10 "2021-10-26T18:19:58Z")

</div>

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](https://blog.gradle.org/alignment-with-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.

---

<div class="post-metadata">

**Author:** ![Pritam\_Kumar2](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/pritam_kumar2/32/1342_2.png) [@Pritam\_Kumar2](https://community.temporal.io/u/Pritam_Kumar2)\
**Post date:** [October 27, 2021, 5:31am UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/11 "2021-10-27T05:31:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [October 27, 2021, 1:07pm UTC](https://community.temporal.io/t/workflowservicestubs-newinstance-throwing-method-not-found-error/3214/12 "2021-10-27T13:07:05Z")

</div>

@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.
