# file in src/gatling/resources throwing FileNotFoundException

**URL:** <https://community.gatling.io/t/file-in-src-gatling-resources-throwing-filenotfoundexception/6409>\
**Category:** Gatling (Open-Source)\
**Created:** [January 28, 2022, 8:23pm UTC](https://community.gatling.io/t/file-in-src-gatling-resources-throwing-filenotfoundexception/6409 "2022-01-28T20:23:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Natale](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@Joseph\_Natale](https://community.gatling.io/u/Joseph_Natale)\
**Post date:** [January 28, 2022, 8:23pm UTC](https://community.gatling.io/t/file-in-src-gatling-resources-throwing-filenotfoundexception/6409/1 "2022-01-28T20:23:44Z")

</div>

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?

---

<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:** [January 28, 2022, 9:45pm UTC](https://community.gatling.io/t/file-in-src-gatling-resources-throwing-filenotfoundexception/6409/2 "2022-01-28T21:45:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Joseph\_Natale](https://avatars.discourse-cdn.com/v4/letter/j/d07c76/32.png) [@Joseph\_Natale](https://community.gatling.io/u/Joseph_Natale)\
**Post date:** [January 28, 2022, 11:42pm UTC](https://community.gatling.io/t/file-in-src-gatling-resources-throwing-filenotfoundexception/6409/3 "2022-01-28T23:42:43Z")

</div>

We’ll that’s embarrassing 🙂

Thanks for the assist!

---

<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:** [January 29, 2022, 8:26am UTC](https://community.gatling.io/t/file-in-src-gatling-resources-throwing-filenotfoundexception/6409/4 "2022-01-29T08:26:55Z")

</div>

Glad you got it sorted out now 🙂
