Running Test suite in Amazon Ec2 instance using KRE (non-GUI)

Hi everyone, i’m trying to run katalon script in Amazon Ec2 but im getting
Caught: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
what i understand by error message is i’m missing webdriver but i don’t know how to set up Webdriver path i thought KRE(Katalon Runtime Enviornment) provide all these modules. i made sure i have Java 8 installed.

what am i missing here ?

You need OpenJDK, not Oracle JDK.

Are you sure you are running ./katalonc command with Open JDK? Please make sure.

yes im using openjdk


openjdk version "1.8.0_362"
OpenJDK Runtime Environment (build 1.8.0_362-b08)
OpenJDK 64-Bit Server VM (build 25.362-b08, mixed mode)

/home/ec2-user/automation/Katalon_Studio_Engine_Linux_64-8.5.5/katalonc -noSplash -runMode=console -projectPath="/home/ec2-user/automation/testing-automation/ec2-testing/ec2-testing.prj" -retry=0 -testSuitePath="Test Suites/New Test Suite" -browserType="Chrome (headless)" -executionProfile="default" -apiKey="******************" --config -proxy.auth.option=NO_PROXY -proxy.system.option=NO_PROXY -proxy.system.applyToDesiredCapabilities=true --config -webui.autoUpdateDrivers=true

This is the command i generated and ran

Please show the current working directory for the the script you showed. You can just type

$ pwd

I guess, the current working directory is something different from /home/ec2-user/automation/Katalon_Studio_Engine_Linux_64-8.5.5.

I think, the katalonc script assumes the current working directory to be equal to /home/ec2-user/automation/Katalon_Studio_Engine_Linux_64-8.5.5

In other words, you shoul do

$ cd /home/ec2-user/automation/Katalon_Studio_Engine_Linux_64-8.5.5
$ ./katalonc -noSplash .....

as the example in the Document shows.

No. You are wrong. The org.openqa.selenium.WebDriver is not a part of the WebDriver library.
It is a part of the “Selenium-java” library, which is of course bundled in the distribution of Kataln Runtime Environment.

This message implies that katalonc shell script could not find the jar files bundled in the Katalon Runtime Environment at all. The katalonc could not initialize the CLASSPATH for with Selenium-java jars etc. Possiblly, the current working directory is not set as the katalonc script expects.

/home/ec2-user/automation/Katalon_Studio_Engine_Linux_64-8.5.5
This is the pwd and i ran

./katalonc -noSplash -runMode=console -projectPath="/home/ec2-user/automation/testing-automation/ec2-testing/ec2-testing.prj" -retry=0 -testSuitePath="Test Suites/New Test Suite" -browserType="Chrome (headless)" -executionProfile="default" -apiKey="***************"

Even i think that KRE will provide bundles for running script

chromedriver is located at default location: /home/ec2-user/.eclipse/2092021755_linux_gtk_x86_64/configuration/resources/drivers/chromedriver_linux64/chromedriver

im getting this message while running but there is not folder called drivers when i manually checked

hi @kazurayam is there is enviorment variable i not set ?

i do not know.

how about installing it again?

Have you checked the souce of katalonc and which jar files it requires?
Have you checked if the jar which contains this class is there on the machine?

I guess, you don’t have the jar on your machine.

hi @kazurayam i have set KATALON_JAVA_HOME = $JAVA_HOME that webdriver error is gone but im getting new error

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 8: unable to resolve class internal.GlobalVariable
 @ line 8, column 8.
   import internal.GlobalVariable as GlobalVariable

“unable to resolve class internal.GlobalVariable” is an old recurring issue. Many people encountered with it. Search this forum for “unable to resolve class internal.GlobalVariable”. You will find many posts about it. Read them through. I am not sure if they are helpful for you or not. It is likely that you get confused more.

I would suggest removing the following directories before starting ./katalonc. This will let Katalon Studio to perform a clean build.

  1. <projectDir>/bin
  2. <projectDir>/Libs
  3. <projectDir>/.cache
1 Like

Do you run your test as a part of Continuous Intergration? Do you do cloning a Katalon project out of a Git repository?

If so, please check if your Git repository contains a file <projecDir>/Libs/internal/GlobalVariable.groovy or not.

Also please check if the <projectDir>/.gitignore contains a line Libs/ to ignore, or not.

These factors will affect to the statement import internal.GlobalVariable. Too many factors I do not see in your environment.