unable to resolve class okhttp3.OkHttpClient

1
0
-1

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,

Darek

1 answer

1
+1
-1
This one is the BEST answer!

Hello

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.

HTH
Romain

Comments

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?

Notifications