Hi
I am getting below error while starting appium server using above method.
It would be great, if you can help to solve this issue.
I am using 1.4.16 appium version on Mac
io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException: The local appium server has not been started. The given Node.js executable: /usr/local/bin/node Arguments: [/usr/local/lib/node_modules/appium/bin/appium.js, --port, 32394, --address, 127.0.0.1, --udid, 192.168.59.101:5555, --log-level, warn:error:info, --chromedriver-port, 59215, --bootstrap-port, 59214, --no-reset, --nodeconfig, /Users/mayur_d/Test_Branch_3.12/target/test-classes/GridConfig.json, --session-override]
at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:140)
at com.test.gridsetup.GridConfig$1.run(GridConfig.java:202)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/exec/DaemonExecutor
at org.openqa.selenium.os.UnixProcess.(UnixProcess.java:52)
at org.openqa.selenium.os.CommandLine.(CommandLine.java:38)
at io.appium.java_client.service.local.AppiumDriverLocalService.start(AppiumDriverLocalService.java:125)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.exec.DaemonExecutor
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Code i have written is
private void startAppiumServer(final Client client, final String nodeConfigFilePath) throws InterruptedException {
Logger.info("Starting appium server");
executorService = Executors.newSingleThreadExecutor();
executorService.execute(new Runnable() {
public void run() {
try {
AppiumDriverLocalService driverLocalService = AppiumDriverLocalService
.buildService(new AppiumServiceBuilder()
.withAppiumJS(new File("/usr/local/lib/node_modules/appium/bin/appium.js"))
.usingDriverExecutable(new File("/usr/local/bin/node")).withIPAddress("127.0.0.1")
.usingAnyFreePort().withArgument(GeneralServerFlag.UIID, client.getSerialNo())
.withArgument(AndroidServerFlag.BOOTSTRAP_PORT_NUMBER,
"" + client.getBootstrapPort())
.withArgument(GeneralServerFlag.CHROME_DRIVER_PORT,
"" + client.getChromeDriverport())
.withArgument(GeneralServerFlag.NO_RESET)
.withArgument(GeneralServerFlag.SESSION_OVERRIDE)
.withArgument(GeneralServerFlag.LOG_LEVEL, "warn:error:info")
.withArgument(GeneralServerFlag.CONFIGURATION_FILE, nodeConfigFilePath));
Logger.info("Server url: " + driverLocalService.getUrl());
driverLocalService.start();
} catch (Exception e) {
Logger.error("Failed to start appium server. ");
e.printStackTrace();
}
}
});
}