-
-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not able to run mobile app tests using mvn clean test command and seen errors java. lang. NoClassDefFoundError: org/openqa/selenium/remote/RemoteWebElement & java. lang. NoClassDefFoundError: io/appium/java_client/proxy/HasMethodCallListeners. #2118
Comments
bytebuddy uses the system class loader to load classes. In order for classes to be visible to the system loader they must be enumerated in the classpath environment variable, -classpath, or -cp command line option. |
This appears to be similar to #2058. I have faced the same issue ever since 8.5.1 was released. But starting with 9.1.0, the @mykola-mokhnach, using your hint about enumerating specific classes in the export APPIUM_CLASSPATH=/Users/patrickwebster/.m2/repository/io/appium/java-client/9.1.0/java-client-9.1.0.jar:/Users/patrickwebster/.m2/repository/org/seleniumhq/selenium/selenium-api/4.17.0/selenium-api-4.17.0.jar:/Users/patrickwebster/.m2/repository/org/seleniumhq/selenium/selenium-remote-driver/4.17.0/selenium-remote-driver-4.17.0.jar:/Users/patrickwebster/.m2/repository/org/seleniumhq/selenium/selenium-support/4.17.0/selenium-support-4.17.0.jar I extracted the IntelliJ IDEA Maven run command to the terminal, removed all IDEA-specific options and appended " The result is no more java.lang.ClassCastException: class org.openqa.selenium.remote.RemoteWebElement$ByteBuddy$byQ18vpl
at java.base/java.lang.Class.asSubclass(Class.java:3640)
at io.appium.java_client.proxy.Helpers.createProxy(Helpers.java:129)
at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:95)
at io.appium.java_client.pagefactory.utils.ProxyFactory.getEnhancedProxy(ProxyFactory.java:70)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.proxyForAnElement(AppiumFieldDecorator.java:258)
at io.appium.java_client.pagefactory.AppiumFieldDecorator$1.proxyForLocator(AppiumFieldDecorator.java:157)
at org.openqa.selenium.support.pagefactory.DefaultFieldDecorator.decorate(DefaultFieldDecorator.java:61)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:196)
at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:109)
at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:101) These problems started when Byte Buddy was introduced in 8.5.1. I'm not sure how to configure the above hack into my project code. I am curious to know if anyone knows a setting in the POM.xml file that can append values to the JVM Environment
|
This means the |
I removed my entire local Maven cache and the only version on disk after reloading dependencies is 4.17.0 when using java-client 9.1.0, or Selenium version 4.13.0 for java-client 8.5.1. If I make a single character change to the project POM.xml file by changing "8.5.1" to "8.5.0", everything works fine. The dependency list shows only one version of Selenium for any configuration. The effective POM.xml file also shows only one version of the Selenium library. org.seleniumhq.selenium:selenium-api:4.13.0
org.seleniumhq.selenium:selenium-http:4.13.0
org.seleniumhq.selenium:selenium-json:4.13.0
org.seleniumhq.selenium:selenium-manager:4.13.0
org.seleniumhq.selenium:selenium-os:4.13.0
org.seleniumhq.selenium:selenium-remote-driver:4.13.0
org.seleniumhq.selenium:selenium-support:4.13.0 |
I am also getting exactly same issue when executing via If running on old versions like Selenium version 4.13.0 for java-client 8.5.1 then: Please help with this! |
@mykola-mokhnach I am facing the same issue after updating to java-client version: 9.1.0. My question: how and why should I add this to the classpath? it is not an external jar file, it is already included in the project.. |
@mykola-mokhnach, is there any way we can get an option to use the old cglib code and bypass the new bytebuddy implementation? I'd like to move off of 8.5.0 to newer builds. Thanks |
cglib integration has been dropped for a reason: the lib was poorly maintained and had a critical compatibility issue with newer java versions which had never been fixed. I see several possible options there for you:
|
I am also facing this same issue upon running my tests through mvn command on Selenium version 4.17.0 and Appium java client 9.1.0 with Appium server 2.x.x - java.lang.NoClassDefFoundError: io/appium/java_client/proxy/HasMethodCallListeners I tried with different versions of Selenium and Appium Java client, but issues still happens. And this is happening only when i am trying to run my tests via Jenkins. However I am able to run my mobile tests successfully in my local. Please help with this! Appreciate if someone figure out any solution or workaround? Thanks! |
Hi All,
Caused by: java.lang.NoClassDefFoundError: io/appium/java_client/proxy/HasMethodCallListeners The problem occurs when AppiumFieldDecorator is used. Any solution or WA for this issue is appreciated. update: |
The line that throws the exception is: It seems the problem is with the class loaders. |
@AndrasFekete80 Thanks for investigating this. Could you please create a PR? |
Thanks @AndrasFekete80 for fixing this issue. @mykola-mokhnach Any ETA, when this fix will be available in the next release as this is blocking to run my tests via Jenkins |
Hi Guys, |
Description
When i try to run the mobile app test cases using the below configurations then I'm facing multiple issues as mentioned in this ticket.
Environment
Details
I ran mobile app test cases on the above configurations using maven commands
mvn clean test
but saw multiple errors as mentioned in the above description and not able to run the tests successfully.Code To Reproduce Issue [ Good To Have ]
Sorry at the moment I can't share the code as it is company licensed.
Exception Stacktraces
9.0.0 Error Stack Trace:
9.1.0 Error Stack Trace:
Link To Appium Logs
9.0.0 Error Logs & Screenshots:
appium-java-client-9.0.0.log
9.1.0 Error Logs & Screenshots:
appium-java-client-9.1.0.log
Please take a look once and let me know if I'm missing something here. All the mentioned dependencies are available in
pom.xml
andclass
path.Thanks in advance!
The text was updated successfully, but these errors were encountered: