Getting java.lang.NoSuchMethodException when loading PageFactory elements in Java16+
See original GitHub issueDescription
Failed to switch to Java 17 due to issue with running Appium tests:
Caused by:
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
Caused by:
java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2.$Proxy119.proxyClassLookup()
at io.appium.java_client.pagefactory.bys.builder.AppiumByBuilder.prepareAnnotationMethods(AppiumByBuilder.java:84)
Caused by:
at io.appium.java_client.pagefactory.bys.builder.AppiumByBuilder.getFilledValue(AppiumByBuilder.java:91)
at io.appium.java_client.pagefactory.bys.builder.AppiumByBuilder.createBy(AppiumByBuilder.java:147)
at io.appium.java_client.pagefactory.DefaultElementByBuilder.getBys(DefaultElementByBuilder.java:133)
at io.appium.java_client.pagefactory.DefaultElementByBuilder.buildMobileNativeBy(DefaultElementByBuilder.java:170)
at io.appium.java_client.pagefactory.DefaultElementByBuilder.buildBy(DefaultElementByBuilder.java:204)
at io.appium.java_client.pagefactory.AppiumElementLocatorFactory.createLocator(AppiumElementLocatorFactory.java:66)
at io.appium.java_client.pagefactory.AppiumElementLocatorFactory.createLocator(AppiumElementLocatorFactory.java:53)
at io.appium.java_client.pagefactory.AppiumElementLocatorFactory.createLocator(AppiumElementLocatorFactory.java:1)
at org.openqa.selenium.support.pagefactory.DefaultFieldDecorator.decorate(DefaultFieldDecorator.java:56)
at io.appium.java_client.pagefactory.AppiumFieldDecorator.decorate(AppiumFieldDecorator.java:154)
at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:113)
at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:105)
...
at ui.pageobject.ringapp.common.AbstractMobileViewWithHeader.<init>(AbstractMobileViewWithHeader.java:104)
at ui.pageobject.ringapp.devicedetail.ActivateSirenPopupView.<init>(ActivateSirenPopupView.java:9)
... 60 more
Caused by:
java.lang.NoSuchMethodException: jdk.proxy2.$Proxy119.proxyClassLookup()
at java.base/java.lang.Class.getMethod(Class.java:2227)
Caused by:
at io.appium.java_client.pagefactory.bys.builder.AppiumByBuilder.prepareAnnotationMethods(AppiumByBuilder.java:82)
... 76 more
Java 16 also failed. Java 15 is OK.
Environment
- Java client build version or git revision if you use some snapshot: 17
- Appium server version or git revision if you use some snapshot: 1.22.0
- Desktop OS/version used to run Appium if necessary: MacOs Big Sur 11.6
- Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: 12.18.3
- Mobile platform/version under test: iOS/Android
- Real device or emulator/simulator: real
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:15 (10 by maintainers)
Top Results From Across the Web
NoSuchMethodException with PageFactory in Appium
I tried again with JDK 15.0.2, and it works now: unfortunately I don't know exactly why. The following is the init I used...
Read more >java.lang.NoSuchMethodException: jdk.proxy2.$Proxy5 ...
Getting java.lang.RuntimeException: java.lang.NoSuchMethodException: jdk.proxy2. ... I am getting the below exception at line: PageFactory.
Read more >Appium Pagefactory throws noSuchMethodException when ...
Appium Pagefactory throws noSuchMethodException when running from POM ... I get a java.lang.RuntimeException: java.lang.
Read more >appium - Bountysource
Description. I have updated the version appium-java-client to 8.2.0. During the creation of the session, I get an error "org.openqa.selenium.
Read more >3 Steps to Fix NoSuchMethodErrors and ...
NoSuchMethodError : io.reflectoring.nosuchmethod. ... This will cause Java to print out all classes and the JARs they have been loaded from:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@mykola-mokhnach could you merge this fix into 7.6.x version? Thank you
We’d like to publish a new beta as soon as there is a new selenium lib patch available. See https://github.com/appium/java-client/issues/1608 for more details