Q:

NoClassDefFoundError: cucumber/api/DataTable when trying to upgrade to Cucumber 4

I am trying to upgrade my tests to Cucumber 4.  I am using testNG and Maven. 
I have updated my dependency versions for the following:
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>${version.cucumber}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-testng</artifactId>
            <version>${version.cucumber}</version>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-guice</artifactId>
            <version>${version.cucumber}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-jvm</artifactId>
            <version>${version.cucumber}</version>
        </dependency>

But I keep getting the error 'java.lang. NoClassDefFoundError: cucumber/api/DataTable' when trying to run a test. 
This is my runner:
import cucumber.api. CucumberOptions;
import cucumber.api.*; 
import cucumber.api.testng. AbstractTestNGCucumberTests;
import org.testng.annotations. DataProvider;

@CucumberOptions(plugin = {"XXXX"},
    features = "src/test/resources/features",
    glue={"XXXXX"},
    tags = {"@XXXXX"})

public class Cucumber4Runner extends AbstractTestNGCucumberTests {

    @Override
    @DataProvider(parallel = true)
    public Object[][] scenarios() {
        return super.scenarios();
    }

}
I have tried to ensure all versions of dependencies match up but struggling! 

A:

Most probably you have not aligned the import statements (other changes might be needed). 
From the CHANGELOG.md

3.0.0
  ...
  [Core] Replace DataTable with io.cucumber.datatable. DataTable (#1248 M.P. Korstanje, Björn Rasmusson, Marit van Dijk)

Based on your exception message your code is looking for cucumber.api. DataTable
edit There might be also a transient dependency from one of you other dependencies to an older cucumber version. 
Assume the following dependencies only in your pom.xml
<properties>
    <version.cucumber>4.2.0</version.cucumber>
</properties>
<dependencies>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${version.cucumber}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-testng</artifactId>
        <version>${version.cucumber}</version>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-guice</artifactId>
        <version>${version.cucumber}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>io.cucumber</groupId>
        <artifactId>cucumber-jvm</artifactId>
        <version>${version.cucumber}</version>
        <type>pom</type>
    </dependency>
</dependencies>

listing the project dependencies 
$ mvn dependency:tree

would produce the following tree
[INFO] +- io.cucumber:cucumber-java:jar:4.2.0:test
[INFO] |  \- io.cucumber:cucumber-core:jar:4.2.0:compile
[INFO] |     +- io.cucumber:cucumber-html:jar:0.2.7:compile
[INFO] |     +- io.cucumber:gherkin:jar:5.1.0:compile
[INFO] |     +- io.cucumber:tag-expressions:jar:1.1.1:compile
[INFO] |     +- io.cucumber:cucumber-expressions:jar:6.2.0:compile
[INFO] |     \- io.cucumber:datatable:jar:1.1.7:compile
[INFO] |        \- io.cucumber:datatable-dependencies:jar:1.1.7:compile
[INFO] +- io.cucumber:cucumber-testng:jar:4.2.0:compile
[INFO] |  \- org.testng:testng:jar:6.14.3:compile
[INFO] |     +- com.beust:jcommander:jar:1.72:compile
[INFO] |     \- org.apache-extras.beanshell:bsh:jar:2.0b6:compile
[INFO] +- io.cucumber:cucumber-guice:jar:4.2.0:test
[INFO] \- io.cucumber:cucumber-jvm:pom:4.2.0:compile

Have a look if there is somewhere a dependency to

info.cuke:* any version
io.cucumber:cucumber-core version before 3

