unable to resolve class okhttp3.OkHttpClient


I want to use okhttp library in process during "Connectors in" "Script->Groovy 2.4", unfortunately I have errors during execution like:

Script1.groovy: 1: unable to resolve class okhttp3.OkHttpClient
 @ line 1, column 1.
   import okhttp3.OkHttpClient

I tried different way and different versions of OkHttp jar files, but finally I failed...

Currently I used in "Development->Manage dependencies" following jar files:

- okhttp-4.9.1

- kotlin-stdlib-1.5.10

- okio-2.10.0

Librarry stack is correct - I was able to do this task in separate project (in Eclipse) and it works correctly.

Code of script:

import okhttp3.OkHttpClient
OkHttpClient okclient = new OkHttpClient();
return true;

Could you please support me in this issue?

I will buy a beer :)

Thanks in advance,


1 answer

This one is the BEST answer!


In order to add process dependencies you must add them to the process configurations (for a given environment).
By default, you are in the Local environment.
Select the process containing your connector and open the configuration dialog (wrench icon). In the process dependencies you can add jar in the Other category. Adding your 3 dependencies should do the trick.



Submitted by dariusz.skarbek... on Mon, 05/31/2021 - 13:57

Thank you very much! It works :)

Submitted by emmanuel.duchas... on Mon, 05/31/2021 - 17:04

> "I will buy a beer :)"

@romain.bioteau, you earned yourself a beer !

Submitted by dariusz.skarbek... on Wed, 06/02/2021 - 08:12

Yes! With pleasure I will buy a beer :) You earned it :)

Do you have https://www.buymeacoffee.com/ or similar page to drink/beer?