Unable to Run Katalon with Java Code

Dear Thanh To,
I want to run Katalon tests against OAuth 2.0 and Azure AD B2C. In order to generate and refresh Bearer Token I used msal4j library: (import com.microsoft.aad.msal4j).
also in Build.Gradle updated : compile group: ‘com.microsoft.azure’, name: ‘msal4j’, version: ‘1.6.1’

Please see attached screen shot:

@kahmed

If you have already added these JAR files into external library, then try to press Ctrl + Shift + O to automatically import. Does it work ?

No :frowning:

This will never work. Don’t misunderstand. Katalon project is NOT driven by Gradle.

As the following document explains you need to download the required jar and save it into the <projectDir>/Drivers folder. This folder is the only place where Katalon Studio allows users to place additional jar files.

https://docs.katalon.com/katalon-studio/docs/external-libraries.html

Jar file is already in the directory(Drivers). Still not working

Please copy and paste the console log here, and the screenshot of the JAR files you included. I think I saw something about missing dependencies, which may mean you havent included enough JARs.

Here is the Log and Directory:

I doubt if you wrote required import statements in your test case script; somthing like:

import your.package.RefreshTokenParameters
import your.package.PublicClientApplication

@kahmed

If you find yourself wandering in a dependency hell, the following post may be helpful.

Gradle will save you out of the hell.

No I did not write.

The screenshot you attached shows you have msal4j-1.6.1-javadoc.jar in the Drivers folder.

Is this jar the right one? I doubt it.

Jar files named *-javadoc.jar usually contain only the documentation files, do not contain *.class files at all.

@kahmed

Steps:

  • Open terminal, cd to your project directory
  • Type: “gradle katalonCopyDependencies”
  • Reopen your project in Katalon Studio

Not FOund

Deutsch:

Der Befehl "'gradle" ist entweder falsch geschrieben oder
konnte nich gefunden werden

English:

The command "'gradle" is either wrongly spelt or
can not be found

@kahmed

You typed this:

>'gradle katalonCopyDependencies'

This would not work. If you want, type without quotations:

>gradle katalonCopyDependencies
1 Like

@kazurayam , Yes I do understand.
Secondly I tried out this after installing gradle explicitly and having compatibility issues. Please see the screen shot. TBH: I am not that familiar with Gradle.
But this is where I am having an issue.

@duyluong My main objective is to use Katalon with OAuth 2.0 and Azure AD B2C. Because we are using OpenID Connect and ‘Bearer’ Token will be expired after 1 hour. In order to get a new token or refresh the token I need to use msal4j library. Here , I am having issues with external dependancy Please help me out or suggest better work around. Though I can proceed with my task.

The Snippet was being taken from here : https://docs.microsoft.com/en-us/azure/active-directory/develop/migrate-adal-msal-java

Even after removing jar file from file system and successful run of command no success so far.

Caused by: java.io.IOException: Unable to delete file 'C:¥Users¥kahmed¥katalon Studio¥...¥Drivers¥katalon_generated_accessors-smart-1.2.jar'

You need to shutdown Katalon Studio GUI (or close the project) before you execute the command gradle katalonCopyDependency.

When you execute the katalonCopyDependency task, gradle tries to delete all katalon_generated_*.jar files in the Drivers directory. If you have Katalon Studio still running, it will hold the jar files in the Drivers so that gradle fails to delete them.

Even after Successful run. It is still same. 2020-06-24 14_05_35-

What do you mean?

I can not see what your problem is.

What do you expect to happen?

What do you see actually?

PLS have a look at this before next posting