# The requested class is not in classpath or does not extends Simulation

**URL:** <https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141>\
**Category:** Gatling (Open-Source)\
**Created:** [March 25, 2015, 3:57pm UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141 "2015-03-25T15:57:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ulrik\_Skyt](https://avatars.discourse-cdn.com/v4/letter/u/9f8e36/32.png) [@Ulrik\_Skyt](https://community.gatling.io/u/Ulrik_Skyt)\
**Post date:** [March 25, 2015, 3:57pm UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/1 "2015-03-25T15:57:25Z")

</div>

I am trying to upgrade to Gatling 2.1, but I’m stuck because I get this error when running gatling.sh:

`  
The requested class(‘XxxYyyZzz’) can not be found in the classpath or does not extends Simulation.

Choose a simulation number:  
[0] computerdatabase.BasicSimulation  
[1] computerdatabase.advanced.AdvancedSimulationStep01  
[2] computerdatabase.advanced.AdvancedSimulationStep02  
[3] computerdatabase.advanced.AdvancedSimulationStep03  
[4] computerdatabase.advanced.AdvancedSimulationStep04  
[5] computerdatabase.advanced.AdvancedSimulationStep05

`

I tried echo’ing the $GATLING\_CLASSPATH used in gatling.sh and it does include a directory where my compiled simulation script (here named ‘XxxYyyZzz’) is present in the form of a XxxYyyZzz.class file as well as a number of class files for inner classes etc.

The classpath is quite long, so I tried placing this particular directory in front, in case it was because the path was too long, but that didn’t change anything!

My invocation looks like this:

`  
/path/to/gatling-charts-highcharts-bundle-2.1.4/bin/gatling.sh --simulation XxxYyyZzz --results-folder "$HERE/reports --data-folder “$HERE/data”

`

Any suggestions would be appreciated!!

Best regards  
Ulrik

---

<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:** [March 25, 2015, 4:13pm UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/2 "2015-03-25T16:13:08Z")

</div>

Are you sure you don’t miss the package?  
Then, please provide a reproducer.

---

<div class="post-metadata">

**Author:** ![Ulrik\_Skyt](https://avatars.discourse-cdn.com/v4/letter/u/9f8e36/32.png) [@Ulrik\_Skyt](https://community.gatling.io/u/Ulrik_Skyt)\
**Post date:** [March 25, 2015, 6:49pm UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/3 "2015-03-25T18:49:33Z")

</div>

My class does not declare a package.  
I actually tried adding a package in the scala file - and on the startup parameters - that changed nothing.

I guess you’re right, I should look into trying a minimal example and go from there…

/Ulrik

---

<div class="post-metadata">

**Author:** ![Ulrik\_Skyt](https://avatars.discourse-cdn.com/v4/letter/u/9f8e36/32.png) [@Ulrik\_Skyt](https://community.gatling.io/u/Ulrik_Skyt)\
**Post date:** [March 26, 2015, 7:13am UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/4 "2015-03-26T07:13:59Z")

</div>

I tried copying the quickstart example to my performancetest/src folder:

`

```auto
package computerdatabase // 1

import io.gatling.core.Predef._ // 2
import io.gatling.http.Predef._
import scala.concurrent.duration._

class MyBasicSimulation extends Simulation { // 3

  val httpConf = http // 4
    .baseURL("http://computer-database.herokuapp.com") // 5
    .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") // 6
    .doNotTrackHeader("1")
    .acceptLanguageHeader("en-US,en;q=0.5")
    .acceptEncodingHeader("gzip, deflate")
    .userAgentHeader("Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0")

  val scn = scenario("BasicSimulation") // 7
    .exec(http("request_1") // 8
    .get("/")) // 9
    .pause(5) // 10

  setUp( // 11
    scn.inject(atOnceUsers(1)) // 12
  ).protocols(httpConf) // 13
}

```

`

Then I compiled it with this command:

`  
java -cp “$GATLING\_HOME/lib/\*” -Dscala.home=“$GATLING\_HOME/lib” -Dscala.usejavacp=true scala.tools.nsc.Main src/MyBasicSimulation.scala

`

Class files are now placed under my performancetest/computerdatabase/ folder:

`

> ls performancetest/computerdatabase/  
> `  
> MyBasicSimulation.class

I modified the gatling.sh script to echo “$GATLING\_CLASSPATH” the classpath just before invoking the Gatling class with a java command. This is my output:

`

GATLING\_HOME is set to /products/gatling-charts-highcharts-bundle-2.1.4  
Run compiler  
Run Gatling  
/products/gatling-charts-highcharts-bundle-2.1.4/lib/\*:/products/gatling-charts-highcharts-bundle-2.1.4/user-files:/products/gatling-charts-highcharts-bundle-2.1.4/conf:/Users/usk/Work/FMK/fmk-recept/performancetest  
Picked up JAVA\_TOOL\_OPTIONS: -Dfile.encoding=UTF-8 -Xmx2048m  
The requested class(‘computerdatabase.MyBasicSimulation’) can not be found in the classpath or does not extends Simulation.  
Choose a simulation number:  
[0] computerdatabase.BasicSimulation  
[1] computerdatabase.advanced.AdvancedSimulationStep01  
[2] computerdatabase.advanced.AdvancedSimulationStep02  
[3] computerdatabase.advanced.AdvancedSimulationStep03  
[4] computerdatabase.advanced.AdvancedSimulationStep04  
[5] computerdatabase.advanced.AdvancedSimulationStep05  
^C

`

What am I missing?

/Ulrik

---

<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:** [March 26, 2015, 7:16am UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/5 "2015-03-26T07:16:19Z")

</div>

Why don’t you let Gatling do the compiling job?

---

<div class="post-metadata">

**Author:** ![Ulrik\_Skyt](https://avatars.discourse-cdn.com/v4/letter/u/9f8e36/32.png) [@Ulrik\_Skyt](https://community.gatling.io/u/Ulrik_Skyt)\
**Post date:** [March 26, 2015, 7:39am UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/6 "2015-03-26T07:39:32Z")

</div>

I tried the basic example again (with the src in a new folder separate from my previous attempts), and let gatling do the compiling itself and that worked fine!

But trying the same with my own Simulation classes, which make use of a lot of Java code references in the JAVA\_CLASSPATH gave compile errors (.

Therefore I tried modifying gatling.sh with this line:

`

COMPILATION\_CLASSPATH=$COMPILATION\_CLASSPATH:$JAVA\_CLASSPATH

`

… and the it all worked for my code too!

That must be an error in the gatling.sh script, or perhaps in the ZincCompiler, right?

---

<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:** [March 26, 2015, 8:00am UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/7 "2015-03-26T08:00:48Z")

</div>

That’s a bug in our compiler module that’s ignoring java files.  
I’ll fix this, you shouldn’t have to compile yourself.

---

<div class="post-metadata">

**Author:** ![Ulrik\_Skyt](https://avatars.discourse-cdn.com/v4/letter/u/9f8e36/32.png) [@Ulrik\_Skyt](https://community.gatling.io/u/Ulrik_Skyt)\
**Post date:** [April 21, 2015, 12:01pm UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/8 "2015-04-21T12:01:52Z")

</div>

It seems this fix didn’t make into Gatling 2.1.5, right?

/Ulrik

---

<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 27, 2015, 9:48am UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/9 "2015-04-27T09:48:55Z")

</div>

Yes it did: [https://github.com/gatling/gatling/issues/2640](https://github.com/gatling/gatling/issues/2640)

Do you still have an issue? If so, can you share a reproducer please?

---

<div class="post-metadata">

**Author:** ![Ulrik\_Skyt](https://avatars.discourse-cdn.com/v4/letter/u/9f8e36/32.png) [@Ulrik\_Skyt](https://community.gatling.io/u/Ulrik_Skyt)\
**Post date:** [April 27, 2015, 10:50am UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/10 "2015-04-27T10:50:34Z")

</div>

I still have an issue, yes.

It seems your fix has to do with the scala compiler including .java files.

I am trying to compile with my already compiled .class files in the JAVA\_CLASSPATH.

My local fix is to add this line in gatling.sh, just before “# Run the compiler”:

COMPILATION\_CLASSPATH=$COMPILATION\_CLASSPATH:$JAVA\_CLASSPATH

/Ulrik

---

<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 28, 2015, 9:00am UTC](https://community.gatling.io/t/the-requested-class-is-not-in-classpath-or-does-not-extends-simulation/2141/11 "2015-04-28T09:00:34Z")

</div>

Could be related to [https://github.com/gatling/gatling/issues/2694](https://github.com/gatling/gatling/issues/2694)
