# Getting Class Not Found Error When Running Test Using Maven

**URL:** <https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901>\
**Category:** Gatling (Open-Source)\
**Created:** [April 1, 2019, 11:25pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901 "2019-04-01T23:25:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrian\_Nutter](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adrian\_Nutter](https://community.gatling.io/u/Adrian_Nutter)\
**Post date:** [April 1, 2019, 11:25pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/1 "2019-04-01T23:25:22Z")

</div>

No idea what could be causing this, was able to run tests fine this morning, and all I’ve done is move some folders around to organize my tests better. I did update the simulationsFolder.

POM:

```auto
<plugin>
    <groupId>io.gatling</groupId>
    <artifactId>gatling-maven-plugin</artifactId>
    <version>${gatling.plugin.version}</version>
    <configuration>
        <simulationsFolder>src/test/java/tests/performance</simulationsFolder>
    </configuration>
</plugin>

```

FOLDER STRUCTURE:  
 ![Auto Generated Inline Image 1.png](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/1X/654ff8da743fe1fc11a1f8266c5ea2a9759063cf.png)

CLI COMMAND:

> `<br>$ mvn clean test gatling:test -Dgatling.simulationClass=get_sites_baseline<br>`  
>   
>   
> |
> 
> - |

ERROR:

---

<div class="post-metadata">

**Author:** ![Anupam\_Das](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@Anupam\_Das](https://community.gatling.io/u/Anupam_Das)\
**Post date:** [April 2, 2019, 5:52pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/2 "2019-04-02T17:52:54Z")

</div>

> Can you please try adding the below   
> Can you also add goals and execute using the maven gatling goals.

So basically the particular section would look like

**io.gatling**  
**gatling-maven-plugin**  
**2.2.1**  
  
**src/test/java/tests**  
**servicerequests.get\_service\_requests\_instance\_baseline**  
  
  
  
  
**integration-test**

and the command to execute should be as below

**mvn clean install gatling:integration-test**

---

<div class="post-metadata">

**Author:** ![Adrian\_Nutter](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adrian\_Nutter](https://community.gatling.io/u/Adrian_Nutter)\
**Post date:** [April 2, 2019, 6:43pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/3 "2019-04-02T18:43:11Z")

</div>

I had tried that, but not ideal as I don’t want my POM to require adding a line for every performance test we run. Was able to get things working by adding a “runner” object file, and this also allows me to debug in IntelliJ.

```auto
package tests.performance.sites

import io.gatling.app.Gatling
import io.gatling.core.config.GatlingPropertiesBuilder

object SitesRunner {

  def main(args: Array[String]): Unit = {

    val simClass = classOf[get_sites_baseline].getName

    val props = new GatlingPropertiesBuilder
    props.simulationClass(simClass)

    Gatling.fromMap(props.build)
  }

}

```

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 2, 2019, 6:46pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/4 "2019-04-02T18:46:50Z")

</div>

If you’re not familiar with Java and maven, instead of trying to change the layout, you’d better stick to the default one, like what you can find in our demo: [https://github.com/gatling/gatling-maven-plugin-demo](https://github.com/gatling/gatling-maven-plugin-demo)

---

<div class="post-metadata">

**Author:** ![Adrian\_Nutter](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adrian\_Nutter](https://community.gatling.io/u/Adrian_Nutter)\
**Post date:** [April 3, 2019, 4:26pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/5 "2019-04-03T16:26:09Z")

</div>

So I created a new repo, based on the demo project you listed, but not seeing any syntax highlighting for my variables, and my java file now has a weird icon(using IntelliJ). Wondering if something is missing from my POM? Using Java 11 since it’s latest LTS, and saw it’s supposed to be supported.

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 3, 2019, 4:28pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/6 "2019-04-03T16:28:29Z")

</div>

You probably haven’t installed the Scala plugin for IntelliJ.

---

<div class="post-metadata">

**Author:** ![Adrian\_Nutter](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adrian\_Nutter](https://community.gatling.io/u/Adrian_Nutter)\
**Post date:** [April 3, 2019, 4:31pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/7 "2019-04-03T16:31:03Z")

</div>

I already had it installed, was required for my original Karate/Gatling project. Scala SDK is also installed, using 2.12.7

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 3, 2019, 4:34pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/8 "2019-04-03T16:34:25Z")

</div>

Have you correctly imported project as a maven one?

• make sure JDK is properly configured  
• maybe for maven project reimport

---

<div class="post-metadata">

**Author:** ![Adrian\_Nutter](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adrian\_Nutter](https://community.gatling.io/u/Adrian_Nutter)\
**Post date:** [April 3, 2019, 4:53pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/9 "2019-04-03T16:53:43Z")

</div>

Yes, imported as Maven. Tried removing and re-importing. JDK is set to 11. Will continue trying to troubleshoot.

---

<div class="post-metadata">

**Author:** ![Adrian\_Nutter](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adrian\_Nutter](https://community.gatling.io/u/Adrian_Nutter)\
**Post date:** [April 3, 2019, 5:03pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/10 "2019-04-03T17:03:27Z")

</div>

Maybe something in my POM:

```auto
<properties>
  <maven.compiler.source>11.2</maven.compiler.source>
  <maven.compiler.target>11.2</maven.compiler.target>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  <gatling.version>3.0.3</gatling.version>
  <gatling-plugin.version>3.0.2</gatling-plugin.version>
</properties>

```

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 3, 2019, 5:10pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/11 "2019-04-03T17:10:29Z")

</div>

Revert your change regarding maven source and target version (1.8 in our demo).

---

<div class="post-metadata">

**Author:** ![Adrian\_Nutter](https://avatars.discourse-cdn.com/v4/letter/a/90ced4/32.png) [@Adrian\_Nutter](https://community.gatling.io/u/Adrian_Nutter)\
**Post date:** [April 3, 2019, 5:49pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/12 "2019-04-03T17:49:30Z")

</div>

Got things working, seems the folders needed to be re-mapped to source in my IDE. But for some reason the io.gatling dependencies are not automatically available to import in the scala files. For example I had to add gatling-http, but before it was automatically available.

But are you saying Java 11 is not supported, only 8?

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [April 3, 2019, 6:53pm UTC](https://community.gatling.io/t/getting-class-not-found-error-when-running-test-using-maven/4901/13 "2019-04-03T18:53:41Z")

</div>

No, Gatling works perfectly fine with the Java 11 runtime.  
And our demo project works out of the box.

The source option is about the Java APIs you want to use and the target one is about the bytecode version you want to emit. The Scala compiler doesn’t support emitting Java 11 bytecode yet.

Your problems come from your modifications, you’d save you a lot of pain if you were to stick to the defaults.
