Maven error : java.lang.reflect.InvocationTargetException, while upgrading Gatling from 2.2.0 to 2.3.1

Hi,

I’m getting this error :

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.NoClassDefFoundError: scala/Function0$class
at org.json4s.ThreadLocal.(Formats.scala:337)
at org.json4s.DefaultFormats$class.$init$(Formats.scala:344)
at org.json4s.DefaultFormats$.(Formats.scala:322)
at org.json4s.DefaultFormats$.(Formats.scala)
at com.bioware.bigs.gatling.Service.StressInventory$.(StressInventory.scala:51)
at com.bioware.bigs.gatling.Service.StressInventory$.(StressInventory.scala)
at com.bioware.bigs.gatling.AnthemScenarios.MenuFlow$.(MenuFlow.scala:42)
at com.bioware.bigs.gatling.AnthemScenarios.MenuFlow$.(MenuFlow.scala)
at com.bioware.bigs.gatling.Simulation.LoadTestSimulation.(LoadTestSimulation.scala:39)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at io.gatling.app.Runner.run0(Runner.scala:79)
at io.gatling.app.Runner.run(Runner.scala:64)
at io.gatling.app.Gatling$.start(Gatling.scala:63)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:45)
at io.gatling.app.Gatling$.main(Gatling.scala:37)
at io.gatling.app.Gatling.main(Gatling.scala)
… 6 more
Caused by: java.lang.ClassNotFoundException: scala.Function0$class
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 26 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

My pom.xml file is :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <prerequisites>
        <maven>3.5.3</maven>
    </prerequisites>

    <groupId>com.bioware.bigs</groupId>
    <artifactId>bigs-loadtests</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <gatling.version>2.3.1</gatling.version>
        <gatling-plugin.version>2.2.4</gatling-plugin.version>
        <gatling.skip>false</gatling.skip>
        <path.config.file>${project.basedir}/src/test/resources/config.properties</path.config.file>
        <gatling.environment>${env.USER}</gatling.environment>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.scalaj</groupId>
            <artifactId>scalaj-time_2.11</artifactId>
            <version>0.8</version>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.12.6</version>
        </dependency>
        <dependency>
            <groupId>io.gatling.highcharts</groupId>
            <artifactId>gatling-charts-highcharts</artifactId>
            <version>${gatling.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-core</artifactId>
            <version>${gatling.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-http</artifactId>
            <version>${gatling.version}</version>
        </dependency>
        <dependency>
            <groupId>io.gatling</groupId>
            <artifactId>gatling-maven-plugin</artifactId>
            <version>${gatling-plugin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.json4s</groupId>
            <artifactId>json4s-native_2.11</artifactId>
            <version>3.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <version>2.12.6</version>
        </dependency>
    </dependencies>
    <build>
        <defaultGoal>install</defaultGoal>
        <sourceDirectory>src/test/scala</sourceDirectory>
        <testSourceDirectory>src/test/scala</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>io.gatling</groupId>
                <artifactId>gatling-maven-plugin</artifactId>
                <version>${gatling-plugin.version}</version>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>LOADTEST</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.gatling</groupId>
                        <artifactId>gatling-maven-plugin</artifactId>
                        <version>${gatling-plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <dataFolder>src/test/resources/data</dataFolder>
                            <bodiesFolder>src/test/resources/bodies</bodiesFolder>
                            <resultsFolder>target/gatling/results</resultsFolder>
                            <simulationsFolder>src/test/scala</simulationsFolder>
                            <simulationClass>${gatling.simulation}</simulationClass>
                            <jvmArgs>
                                <!-- Enable this for debugging: -->
                                <!--jvmArg>-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=7000</jvmArg-->
                            </jvmArgs>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

Command I’m using to execute : >mvn -P=LOADTEST -Denv=dev -Dgatling.simulation=com.bioware.bigs.gatling.Simulation.LoadTestSimulation

Maven Version: 3.5.3
JDK Version: 1.8.0_181

I’m not getting what I have missed. Please help me out.

https://gatling.io/docs/current/migration_guides/2.2-to-2.3/

I have missed upgrading one dependency (org.native.json4s) to 2.12.X

Thanks.