Java.lang.LinkageError RFT-Selenium-Appium

Java.lang.LinkageError RFT-Selenium-Appium,java,selenium,command-line,appium,rft,Java,Selenium,Command Line,Appium,Rft,我被困在这种情况下,我查阅了很多文档,但我找不到解决方案,我正在从事一个自动化web和移动应用程序的项目,有时两者同时进行,因为它们之间必须传输信息 当从IDE(RFT)本身运行时,自动操作可以正常工作,但是如果我尝试从控制台运行它,它会抛出以下错误 exception_name = java.lang.LinkageError exception_message = loading constraint violation when overriding method "org/op

我被困在这种情况下,我查阅了很多文档,但我找不到解决方案,我正在从事一个自动化web和移动应用程序的项目,有时两者同时进行,因为它们之间必须传输信息

当从IDE(RFT)本身运行时,自动操作可以正常工作,但是如果我尝试从控制台运行它,它会抛出以下错误

exception_name = java.lang.LinkageError
exception_message = loading constraint violation when overriding method "org/openqa/selenium/remote/RemoteWebElement.findElement(Lorg/openqa/selenium/By;)Lorg/openqa/selenium/WebElement;" during creation of class "io/appium/java_client/DefaultGenericMobileElement": loader "com/rational/test/ft/util/FtClassLoader@c6ae7474" of class "io/appium/java_client/DefaultGenericMobileElement" and loader "com/rational/test/ft/util/FtClassLoader@a4fe6ba3" of class "org/openqa/selenium/remote/RemoteWebElement" have different types for the method signature
script_name = Platforms.Test.Test
script_id = Platforms.Test.Test.java
line_number = 40
exception_stack = at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
at com.rational.test.ft.util.FtClassLoader.loadClass(FtClassLoader.java:159)
at java.lang.ClassLoader.loadClass(ClassLoader.java:854)
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:379)
at com.rational.test.ft.util.FtClassLoader.loadClass(FtClassLoader.java:159)
at java.lang.ClassLoader.loadClass(ClassLoader.java:854)
at com.rational.test.ft.util.FtClassLoader.callRelatedClassLoaders(FtClassLoader.java:356)
at com.rational.test.ft.util.FtClassLoader.loadClass(FtClassLoader.java:163)
at java.lang.ClassLoader.loadClass(ClassLoader.java:854)
at Platforms.Test.Test.testMain(Test.java:40)
at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
at org.eclipse.core.launcher.Main.main(Main.java:34)
这就是我从命令行运行自动化的方式,kernel.jar是一组用Ant打包的库,其中包含java-client-7.3.0(io.appium.java_-client),selenium.jar是selenium-server-standalone-3.141.59(org.openqa.selenium):

自动化脚本非常简单,它导入一个包含功能的类,使用selenium连接到web门户,检索安全代码,然后使用appium使用该代码在应用程序中进行身份验证并执行其他操作,如果从IDE本身运行,我重复所有操作都能正常工作

public class Test extends TestHelper
{
    /**
     * 
     * @since  2020/08/21
     * @author jddeltoro
     */
    public void testMain(Object[] args) 
    {
        Framework fw =  Framework.getInstance();
        try {
            fw.initEnviromentTokens();
            
            WebAppAutomation waa= new WebAppAutomation(fw);
            waa.init();
            String code = wpa.reatriveSecurityCode();
            waa.quit();

            MobileAppAutomation maa= new MobileAppAutomation(fw);
            maa.init();
            maa.executeProcess(code);
            maa.quit();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
另一个重要线索是,如果我从仅实例化Selenium或仅实例化Appium的命令行运行脚本,则不会显示java.lang.LinkageError,这表明该命令是正确的。 通过控制台执行的原因是我远程执行执行,有数千个脚本,当一个脚本完成时,我开始执行另一个脚本

注: 如果我使用已安装的java vm,则例外情况类似:

"java -classpath "C:\Program Files\IBM\SDP\FunctionalTester\bin\rational_ft.jar" com.rational.test.ft.rational_ft -datastore "C:\Workspaces\RFT\Project" -projectpath "C:\Workspaces\RFT\Project\libs\inuse\kernel.jar;C:\Workspaces\RFT\Project\libs\inuse\selenium.jar" -log "Project.Test.Test" -playback "Platforms.Test.Test" -args "Test"

exception_name = java.lang.LinkageError
exception_message = loader constraint violation: when resolving overridden method "io.appium.java_client.DefaultGenericMobileDriver.findElementById(Ljava/lang/String;)Lorg/openqa/selenium/WebElement;" the class loader (instance of com/rational/test/ft/util/FtClassLoader) of the current class, io/appium/java_client/DefaultGenericMobileDriver, and its superclass loader (instance of com/rational/test/ft/util/FtClassLoader), have different Class objects for the type org/openqa/selenium/WebElement used in the signature

我最终使用不同的触发器命令解决了这个问题:

"C:\Program Files\IBM\SDP\jdk\bin\javaw.exe" -Dfile.encoding=Cp1252 -classpath "C:\Workspaces\RFT\Project\libs\inuse\kernel.jar;C:\Workspaces\RFT\Project\libs\inuse\selenium.jar;C:\Program Files\IBM\SDP\FunctionalTester\bin\rational_ft.jar" com.rational.test.ft.rational_ft -projectpath C:\Workspaces\RFT\Project -datastore C:\Workspaces\RFT\Project -idetype wswplugin -rt.interactive true -rt.log_format html -log Platforms.Test.Test -iterationcount ALL -rt.log_action false -rt.log_screen_snapshot false -playback Platforms.Test.Test
"C:\Program Files\IBM\SDP\jdk\bin\javaw.exe" -Dfile.encoding=Cp1252 -classpath "C:\Workspaces\RFT\Project\libs\inuse\kernel.jar;C:\Workspaces\RFT\Project\libs\inuse\selenium.jar;C:\Program Files\IBM\SDP\FunctionalTester\bin\rational_ft.jar" com.rational.test.ft.rational_ft -projectpath C:\Workspaces\RFT\Project -datastore C:\Workspaces\RFT\Project -idetype wswplugin -rt.interactive true -rt.log_format html -log Platforms.Test.Test -iterationcount ALL -rt.log_action false -rt.log_screen_snapshot false -playback Platforms.Test.Test