Null point error on start of basic server

Using:Appium 2
Intellij as the IDE
Starts from the cmd line fine using the command: appium server -pa /wd/hub

Hi, I am doing some Appium training from a Blazemeter course and the have this test file, written the same way as the course (which runs)

package com.perforce;

import io.appium.java_client.service.local.AppiumDriverLocalService;
import io.appium.java_client.service.local.AppiumServiceBuilder;
import io.appium.java_client.service.local.flags.GeneralServerFlag;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

 * Unit test for simple App.
public class AppTest  {

    AppiumDriverLocalService appiumService;
    public void startServer(){
        AppiumServiceBuilder appiumServiceBuilder = new AppiumServiceBuilder();
        appiumServiceBuilder.withArgument(GeneralServerFlag.BASEPATH, "/wd/hub");

    public void serverTest(){
        System.out.println("Server test");

    public void stopServer(){

When running this from the command line via Maven (as per the course) “mvn clean test” I get the following error

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.122 s <<< FAILURE! – in com.perforce.AppTest
[ERROR] com.perforce.AppTest.serverTest – Time elapsed: 1.069 s <<< ERROR!
at java.base/
at java.base/
at org.openqa.selenium.remote.service.DriverService$Builder.getLogOutput(
at org.openqa.selenium.remote.service.DriverService$
at com.perforce.AppTest.startServer(
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(
at java.base/java.lang.reflect.Method.invoke(
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
at org.junit.runners.model.FrameworkMethod.invokeExplosively(
at org.junit.internal.runners.statements.RunBefores.invokeMethod(
at org.junit.internal.runners.statements.RunBefores.evaluate(
at org.junit.internal.runners.statements.RunAfters.evaluate(
at org.junit.runners.ParentRunner$3.evaluate(
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(
at org.junit.runners.ParentRunner.runLeaf(
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
at org.junit.runners.BlockJUnit4ClassRunner.runChild(
at org.junit.runners.ParentRunner$
at org.junit.runners.ParentRunner$1.schedule(
at org.junit.runners.ParentRunner.runChildren(
at org.junit.runners.ParentRunner.access$100(
at org.junit.runners.ParentRunner$2.evaluate(
at org.junit.runners.ParentRunner$3.evaluate(
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(
at org.apache.maven.surefire.booter.ForkedBooter.execute(
at org.apache.maven.surefire.booter.ForkedBooter.main(

[INFO] Results:
[ERROR] Errors:
[ERROR] AppTest.startServer:22 ┬╗ NullPointer
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.081 s
[INFO] Finished at: 2023-09-18T09:04:30+12:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.1.2:test (default-test) on project Appium2DemoProject:
[ERROR] Please refer to C:\Temp\MavenProject\Appium2DemoProject\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1]

Any ideas please?

Can someone explain this to me

How does “GeneralServerFlag.BASEPATH” tell it where appium is ?

Worked out why it was failing, it needed to have the following line added

.withLogFile(new File( “C:\Temp\MavenProject\Appium2DemoProject\test.txt”));

It was throwing the null pointer exception because it didn;t have a log file to write to, no clear and obvious error message for people who are not developer centric.

Edit - to which it has not added any content yet too in about 5 runs