file in src/gatling/resources throwing FileNotFoundException

Hi there, not sure if I’m missing something in the doc but I’m getting a FileNotFoundException when trying to read a file stored in src/gatling/resources

here’s my setup:
api
–src
----gatling
--------java
------------simulations/util code here
--------resources

------------gatling.conf
------------feeders
----------------feeder1.csv
------------seeders
----------------seeder1.txt
----main
--------application/code/here/
----test
--------/application/code/unit/tests

I have a simulation in under src/gatling/java/… which successfully reads the gatling.conf and feeder1.csv for my test. However, I’m overriding the ‘before()’ method in order to read the seeders/seeder1.txt to write some data to postgres and I’m getting a file not found. What am I missing here?

You shouldn’t try to load a file from the filesystem but load a resource from the ClassLoader. Check getResourceAsStream.

We’ll that’s embarrassing :slight_smile:

Thanks for the assist!

Glad you got it sorted out now :slight_smile: