KRE does not recognize the MobileElement class (java.lang.NoClassDefFoundError: MobileElement)

User information
gdelanieve@banreservas.com

*Summary
What happens to us is that when we execute our project through the command line (KRE), it shows the following exception (java.lang.NoClassDefFoundError: MobileElement).

The most curious thing is that I see that this class is internal to Katalon and still shows this error, in the same way I tried adding it (java-client) by internal plugings, both by Gradle and by the UI of Katalon Studio and still gives this same error.

Thinking I say maybe the KS libraries are not in KRE, I see that inside KRE in the following path (/Katalon_Studio_Engine.app/Contents/Eclipse/Plugins) is where KRE manages the plugins, also there I added the java-client and it doesn’t work either.

I saw in the official documentation that said that it showed the error “NoClassDefFoundError” I should install OpenJDK 17 (This for linux and I am in MacOs), even so I tried it and it also continues with the error.

I also see that .classpath in KS shows this java-client library.

Question, KRE handles the libraries differently, from which folder or takes the libraries loaded in KS → Drivers?

NOTE: Running the tests from KS works perfectly.

*Steps to reproduce
Execute an test automated using the MobileElement class from Java-client

*Expected Results
Run the TS through KRE from start to finish with no remaining class exception failures.

*Actual Results
Running this automated script from KRE will fail and show a java.lang.NoClassDefFoundError: MobileElement exception.

*Screenshots / Videos

*Blocker?
Yes

Number of affected users?
5


*Operating System
MacOS Montery

*Katalon Studio version
9.6.0

*Katalon Studio logs

2025-03-07 09:32:00.247 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['appium:unicodeKeyboard', 'true']
2025-03-07 09:32:00.247 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['platformVersion', '15']
2025-03-07 09:32:00.248 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['automationName', 'UiAutomator2']
2025-03-07 09:32:00.248 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['platformName', 'Android']
2025-03-07 09:32:00.248 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['deviceName', 'emulator-5554']
2025-03-07 09:32:00.248 INFO  c.k.k.c.m.k.i.MobileDriverFactory        - User set preference: ['appium:resetKeyboard', 'true']
2025-03-07 09:32:00.256 INFO  c.k.k.core.appium.util.AppiumDriverUtil  - There are uncompatible capabilities keys which will be replaced: appActivity=appium:appActivity, appPackage=appium:appPackage, newCommandTimeout=appium:newCommandTimeout, platformVersion=appium:platformVersion, automationName=appium:automationName, autoGrantPermissions=appium:autoGrantPermissions, deviceName=appium:deviceName, systemPort=appium:systemPort
2025-03-07 09:32:06.150 INFO  c.k.k.c.a.driver.AppiumRequestService    - appiumVersion = 2.16.2
2025-03-07 09:32:06.151 INFO  c.k.k.c.a.driver.AppiumRequestService    - appiumServerStatus = {"value":{"ready":true,"message":"The server is ready to accept new connections","build":{"version":"2.16.2","git-sha":"64efed206deeb9c2304d9e5b5910dcbf0a509c15","built":"2025-03-02 19:32:54 +0000"}}}
2025-03-07 09:32:06.155 INFO  c.k.k.c.a.driver.AppiumDriverManager     - remoteDriverUrl = http://127.0.0.1:4723
2025-03-07 09:32:06.155 INFO  c.k.k.c.a.driver.AppiumDriverManager     - desiredCapabilities = {
  "appActivity": ".Settings",
  "appPackage": "com.android.settings",
  "appium:resetKeyboard": true,
  "newCommandTimeout": 1800,
  "platformVersion": "15",
  "appium:unicodeKeyboard": true,
  "automationName": "UiAutomator2",
  "autoGrantPermissions": true,
  "platformName": "ANDROID",
  "deviceName": "emulator-5554",
  "systemPort": 8223
}
2025-03-07 09:32:06.435 INFO  c.k.katalon.core.main.TestCaseExecutor   - --------------------
2025-03-07 09:32:06.435 INFO  c.k.katalon.core.main.TestCaseExecutor   - START Test Cases/TC-Scenarios/29-Historico de Transacciones
2025-03-07 09:32:06.444 INFO  c.k.katalon.core.main.TestCaseExecutor   - RNC = 101528273
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - Username1 = margaritaf
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - Password = Br123456!
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - Username2 = automati1
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - Username3 = jaqueline20
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - Email = 123456
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - CuentaOrigen = 9601284249
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - CuentaDestino = 9600431762
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - Description = UsdToUsd-Authorize
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - Monto = 70
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - Concept = UsdToUsd-Authorize
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - CaseNo = CP 1.9
2025-03-07 09:32:06.445 INFO  c.k.katalon.core.main.TestCaseExecutor   - ExpectedTransactionMessage1 = Sometida. Pendiente de autorizaciĂłn
2025-03-07 09:32:06.446 INFO  c.k.katalon.core.main.TestCaseExecutor   - Verification = Authorize
2025-03-07 09:32:06.446 INFO  c.k.katalon.core.main.TestCaseExecutor   - ExpectedAuthMessage2 = Autorizada
2025-03-07 09:32:06.446 INFO  c.k.katalon.core.main.TestCaseExecutor   - ExpectedAuthMessage3 = NOT REQUIRED
2025-03-07 09:32:06.446 INFO  c.k.katalon.core.main.TestCaseExecutor   - Tax = false
2025-03-07 09:32:06.446 INFO  c.k.katalon.core.main.TestCaseExecutor   - Approvals = 1
Test Case Counter: 1
2025-03-07 09:32:06.512 DEBUG testcase.29-Historico de Transacciones   - 1: app = instance
2025-03-07 09:32:06.524 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/TC-Scenarios/29-Historico de Transacciones FAILED.
Reason:
java.lang.NoClassDefFoundError: MobileElement
	at java.desktop/com.sun.beans.introspect.MethodInfo.get(MethodInfo.java:70)
	at java.desktop/com.sun.beans.introspect.ClassInfo.getMethods(ClassInfo.java:80)
	at mobile.actions.PlatformUtils.driverType(PlatformUtils.groovy:19)
	at app.pages.AppPages.getInstance(AppPages.groovy:66)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at 29-Historico de Transacciones.run(29-Historico de Transacciones:10)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.common.CommonExecutor.accessTestCaseMainPhase(CommonExecutor.java:71)
	at com.kms.katalon.core.main.TestSuiteExecutor.accessTestSuiteMainPhase(TestSuiteExecutor.java:160)
	at com.kms.katalon.core.main.TestSuiteExecutor.execute(TestSuiteExecutor.java:107)
	at com.kms.katalon.core.main.TestCaseMain.startTestSuite(TestCaseMain.java:180)
	at com.kms.katalon.core.main.TestCaseMain$startTestSuite$0.call(Unknown Source)
	at TempTestSuite1741354318679.run(TempTestSuite1741354318679.groovy:35)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Caused by: java.lang.ClassNotFoundException: MobileElement
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.desktop/com.sun.beans.introspect.MethodInfo.get(MethodInfo.java:70)
	at java.desktop/com.sun.beans.introspect.ClassInfo.getMethods(ClassInfo.java:80)
	at mobile.actions.PlatformUtils.driverType(PlatformUtils.groovy:19)
	at app.pages.AppPages.getInstance(AppPages.groovy:66)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at Script1735830533335.run(Script1735830533335.groovy:10)
	... 16 more

Environment (for Mobile Testing)
Android

Appium version
2.16.2

Mobile platform/version under test: (for example: iOS 11 or Android 7)
Android 15

1 Like

Hi there, and thanks for posting in the Katalon community! :hugs:

To help you faster, please review our guide on Git here:

Double-checking the steps and configurations might resolve the issue.

If the doc doesn’t help, feel free to provide more details, and a community member will assist you soon. Thanks for being a part of our community!

Best,
Albert Le

I see that MobileElement keyword needs to be replaced in version 10 - see this guide below:

Perhaps you can confirm what version of KRE you are using, as KSE may be version 9 but KRE may be more recent…?

" To align with Selenium’s standard approach for locating elements, you need to replace MobileElement with WebElement ."

1 Like