Classpath problem on Mac

These are my errors:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 10: unable to resolve class com.kms.katalon.core.windows.keyword.contribution.WindowsDriverCleaner
 @ line 10, column 1.
   import com.kms.katalon.core.windows.keyword.contribution.WindowsDriverCleaner
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 3: unable to resolve class com.kms.katalon.core.testcase.TestCaseBinding
 @ line 3, column 1.
   import com.kms.katalon.core.testcase.TestCaseBinding
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 8: unable to resolve class com.kms.katalon.core.mobile.contribution.MobileDriverCleaner
 @ line 8, column 1.
   import com.kms.katalon.core.mobile.contribution.MobileDriverCleaner
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 4: unable to resolve class com.kms.katalon.core.driver.internal.DriverCleanerCollector
 @ line 4, column 1.
   import com.kms.katalon.core.driver.internal.DriverCleanerCollector
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 5: unable to resolve class com.kms.katalon.core.model.FailureHandling
 @ line 5, column 1.
   import com.kms.katalon.core.model.FailureHandling
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 6: unable to resolve class com.kms.katalon.core.configuration.RunConfiguration
 @ line 6, column 1.
   import com.kms.katalon.core.configuration.RunConfiguration
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 7: unable to resolve class com.kms.katalon.core.webui.contribution.WebUiDriverCleaner
 @ line 7, column 1.
   import com.kms.katalon.core.webui.contribution.WebUiDriverCleaner
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 9: unable to resolve class com.kms.katalon.core.cucumber.keyword.internal.CucumberDriverCleaner
 @ line 9, column 1.
   import com.kms.katalon.core.cucumber.keyword.internal.CucumberDriverCleaner
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 1: unable to resolve class com.kms.katalon.core.main.TestCaseMain
 @ line 1, column 1.
   import com.kms.katalon.core.main.TestCaseMain
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 2: unable to resolve class com.kms.katalon.core.logging.KeywordLogger
 @ line 2, column 1.
   import com.kms.katalon.core.logging.KeywordLogger
   ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 13: unable to resolve class com.kms.katalon.core.webui.contribution.WebUiDriverCleaner 
 @ line 13, column 55.
   etInstance().addDriverCleaner(new com.km
                                 ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 14: unable to resolve class com.kms.katalon.core.mobile.contribution.MobileDriverCleaner 
 @ line 14, column 55.
   etInstance().addDriverCleaner(new com.km
                                 ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 15: unable to resolve class com.kms.katalon.core.cucumber.keyword.internal.CucumberDriverCleaner 
 @ line 15, column 55.
   etInstance().addDriverCleaner(new com.km
                                 ^

/Users/eric.hansen/Katalon Studio/Test/Libs/TempTestCase1574348000909.groovy: 16: unable to resolve class com.kms.katalon.core.windows.keyword.contribution.WindowsDriverCleaner 
 @ line 16, column 55.
   etInstance().addDriverCleaner(new com.km
                                 ^

14 errors

Here’s the groovy file Katalon generated that errored out:

import com.kms.katalon.core.main.TestCaseMain
import com.kms.katalon.core.logging.KeywordLogger
import com.kms.katalon.core.testcase.TestCaseBinding
import com.kms.katalon.core.driver.internal.DriverCleanerCollector
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.configuration.RunConfiguration
import com.kms.katalon.core.webui.contribution.WebUiDriverCleaner
import com.kms.katalon.core.mobile.contribution.MobileDriverCleaner
import com.kms.katalon.core.cucumber.keyword.internal.CucumberDriverCleaner
import com.kms.katalon.core.windows.keyword.contribution.WindowsDriverCleaner


DriverCleanerCollector.getInstance().addDriverCleaner(new com.kms.katalon.core.webui.contribution.WebUiDriverCleaner())
DriverCleanerCollector.getInstance().addDriverCleaner(new com.kms.katalon.core.mobile.contribution.MobileDriverCleaner())
DriverCleanerCollector.getInstance().addDriverCleaner(new com.kms.katalon.core.cucumber.keyword.internal.CucumberDriverCleaner())
DriverCleanerCollector.getInstance().addDriverCleaner(new com.kms.katalon.core.windows.keyword.contribution.WindowsDriverCleaner())


RunConfiguration.setExecutionSettingFile('/var/folders/r1/rfnb51z16_3gc7lqpb9rrhhj071tnc/T/Katalon/Test Cases/New Test Case/20191121_065310/execution.properties')

TestCaseMain.beforeStart()

        TestCaseMain.runTestCase('Test Cases/New Test Case', new TestCaseBinding('Test Cases/New Test Case',[:]), FailureHandling.STOP_ON_FAILURE , false)

Here’s the test case I tried to run:

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint

import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase

import static com.kms.katalon.core.testdata.TestDataFactory.findTestData

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject

import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint

import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW

import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

import com.kms.katalon.core.model.FailureHandling as FailureHandling

import com.kms.katalon.core.testcase.TestCase as TestCase

import com.kms.katalon.core.testdata.TestData as TestData

import com.kms.katalon.core.testobject.TestObject as TestObject

import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows

import internal.GlobalVariable as GlobalVariable

WebUI.navigateToUrl('https://apple.com')

Here’s the .classpath file in the project: classpath file copy.txt (15.9 KB)

Hi @eric.hansen,

I’d be interest to know:

  1. What is your version of Java and where is it installed?
    java --version
    which java
  2. What is your version of groovy and where is it installed?
    groovy --version
    which groovy

A couple of things that you can try:

  1. There are a lot of extra import statements for the test you’re trying to run in your last example. You should only need import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI. it might not fix things, but it will greatly shorten the error messages.

  2. I don’t think WebUI.navigateToUrl will work without first opening a browser in the test, so you can try WebUI.openBrowser('https://apple.com') instead.

  3. I don’t know if either of those will resolve your underlying issue, which seems to be that the test doesn’t have access to the classes you’re trying to use, which is odd because those should all be included with Katalon. I don’t think it’s a groovy issue, since it seems like the groovy compiler is working, just not finding the files. Here is a screenshot of my Katalon Studio preferences for Groovy to see if anything looks off on yours (these are the defaults - I didn’t have to change anything):

@Chris_Trevarthen thank you for the creative thinking and for taking a look, but I still got the error after making those modifications to the test script and checking the compiler settings were as yours are.

However, groovy did throw an error when i tried groovy -version

$ groovy -version

java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.codehaus.groovy.tools.GroovyStarter.rootLoader(GroovyStarter.java:106)

at org.codehaus.groovy.tools.GroovyStarter.main(GroovyStarter.java:128)

Caused by: java.lang.ExceptionInInitializerError

at groovy.ui.GroovyMain$VersionProvider.getVersion(GroovyMain.java:151)

at groovyjarjarpicocli.CommandLine$Model$CommandSpec.version(CommandLine.java:5715)

at groovyjarjarpicocli.CommandLine.printVersionHelp(CommandLine.java:2472)

at groovyjarjarpicocli.CommandLine.executeHelpRequest(CommandLine.java:1710)

at groovyjarjarpicocli.CommandLine.printHelpIfRequested(CommandLine.java:1671)

at groovyjarjarpicocli.CommandLine.printHelpIfRequested(CommandLine.java:1657)

at groovy.ui.GroovyMain.processArgs(GroovyMain.java:130)

at groovy.ui.GroovyMain.main(GroovyMain.java:116)

... 6 more

Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-xml is loaded in version 2.5.8 and you are trying to load version 2.0.4

at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:524)

at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87)

at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81)

at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModulesFrom(ExtensionModuleScanner.java:63)

at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:55)

at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:125)

at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:86)

at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:36)

... 14 more

FWIW:

$ which groovy

/usr/local/bin/groovy

$ java -version

openjdk version "1.8.0_222"

OpenJDK Runtime Environment (Zulu 8.40.0.25-CA-macosx) (build 1.8.0_222-b10)

OpenJDK 64-Bit Server VM (Zulu 8.40.0.25-CA-macosx) (build 25.222-b10, mixed mode)

$ which java

/usr/bin/java

@david_schleis do you have any antivirus or enterprise tools on your machine? We have jamf, avecto and sentinel one, but my coworkers don’t have this problem, so I’m not sure.

Hi @eric.hansen,

Looks like groovy needs two dashes for the version param, even though java doesn’t: groovy --version.

– Chris

groovy --version returns the same error.

It’s time to do this!?

Update, still not working but I fixed the groovy mismatch error from groovy -version by removing groovy-2.0.4.jar from /Library/Java/Extensions and replacing it with groovy-2.5.7.jar

Also, when that jar is missing, I got this error:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Caught: java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

at com.kms.katalon.core.main.LogbackConfigurator.overrideLogLevels(LogbackConfigurator.java:58)

at com.kms.katalon.core.main.LogbackConfigurator.init(LogbackConfigurator.java:35)

at com.kms.katalon.core.main.TestCaseMain.beforeStart(TestCaseMain.java:54)

at com.kms.katalon.core.main.TestCaseMain$beforeStart.call(Unknown Source)

at TempTestCase1574464213320.run(TempTestCase1574464213320.groovy:21)

When I replace it with a current groovy jar, the same 14 errors from above return.

@Chris_Trevarthen or anybody want to share their bash profile or java class path files so I can make sure I have the right stuff configured? My theory is it’s a configuration thing.

I also checked and my only option is to completely wipe my machine and reimage given it’s a company laptop and they don’t support a system reinstall.

Hi @eric.hansen,

Here is my ~/.profile:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export XCODE_RESOURCES="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources"
export KATALON_PATH="/Applications/Katalon.app/Contents/MacOS"
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export PATH="$XCODE_RESOURCES:$KATALON_PATH:$ANDROID_SDK_ROOT:$ANDROID_SDK_ROOT/emulator:$ANDROID_SDK_ROOT/tools:$PATH"
export PATH="/usr/local/Caskroom/android-sdk/4333796:$PATH"

export JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home

export NVM_DIR="$HOME/.nvm"

[[ -s "/usr/local/opt/nvm/nvm.sh" ]] && source "/usr/local/opt/nvm/nvm.sh"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion
fi

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting

It shouldn’t be an issue, but I wonder if upgrading your version of Java (first removing JDK 8) would help. I have JDK 11 installed. You could try this for OpenJDK12 (we’ve been having other problems with JDK13 so I don’t recommend going that high yet):

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk12

– Chris

1 Like

After cleaning up my java and groovy installs, I’m down to this error:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

SLF4J: Defaulting to no-operation (NOP) logger implementation

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Caught: java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

at com.kms.katalon.core.main.LogbackConfigurator.overrideLogLevels(LogbackConfigurator.java:58)

at com.kms.katalon.core.main.LogbackConfigurator.init(LogbackConfigurator.java:35)

at com.kms.katalon.core.main.TestCaseMain.beforeStart(TestCaseMain.java:54)

at com.kms.katalon.core.main.TestCaseMain$beforeStart.call(Unknown Source)

at TempTestCase1574788374294.run(TempTestCase1574788374294.groovy:21)

Any thoughts? This jar is already included in the classpath and Katalon application bundle, but it is different than the version in my java extensions.

How does your java extensions specifies the version of the logger library? Could you show us your code where you instanciate the logger? — I am asking this because I do not know how.

Katalon Studio itself uses SLF4J and Logback library. This means that you can not control those library for yourself, as KS holds control over them.

I once did a research trying to configure the logging behavior of KS runtime:

My conclusion was: my code can not control the logging behavior of KS runtime at all because KS does not let me do it.

@eric.hansen

I would suggest to you that you should avoid using Logback in your code; rather you shoud use KeywordUtil#loginfo(String) or System.out.println instead. If you stick to the idea of using Logback directly as you want to, you would waste your time as KS would not let you do it.

Same code as above that just opens apple.com—no logging code I’m aware of.

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.openBrowser('https://apple.com')

OK, I understand your test case code has no logging.

Still your test emits java.lang.ClassCastException?

I am afraid I have no idea why, sorry.

My poor guess is that your Katalon Studio installation is somehow broken.

I reinstalled Katalon Studio and used a sample project (Healthcare) and same error.

@Chris_Trevarthen or @david_schleis or @kazurayam any other ideas given all the things I’ve ruled out? Could this be an issue linking to my fresh java install?

java -version is now

openjdk version "12.0.2" 2019-07-16

OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.2+10)

OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12.0.2+10, mixed mode)

@devalex88, @ThanhTo

I have a question to Katalon Team.

I know that the distributable of Katalon Studio bundles Java Runtime Environment. For example, I have KS 7.0.10 on my Mac, and I could run the bundled java as follows:

$ /Applications/Katalon\ Studio.app/Contents/Eclipse/jre/Contents/Home/jre/bin/java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

I think that Katalon Studio uses this jre provided bundled in the distribution, and I think that KS does not rely on the jre outside KS. Am I right?

I ask this because the question asked by @eric.hansen in the above post looks assuming that KS would use the external jre installed by him outside KS, and I feel confused.

If KS is affected for some reason by the version of external JRE outside KS, anything very strange could happen. I hope it is not the case.

Hi @eric.hansen

Here are some more screenshots of my Katalon settings, specifically those that relate to Java. I think they are all defaults, but you might want to check against your installation to see if they match.

– Chris

@kazurayam

Yes, KS was designed to be a stand-alone application. It does not (intentionally) rely on any external JRE.