# Getting Error Can't use the file Datawriter without setting the results directory

**URL:** <https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219>\
**Category:** Gatling (Open-Source)\
**Created:** [August 9, 2024, 8:36am UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219 "2024-08-09T08:36:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ashutosh.trip](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/ashutosh.trip/32/1557_2.png) [@ashutosh.trip](https://community.gatling.io/u/ashutosh.trip)\
**Post date:** [August 9, 2024, 8:36am UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219/1 "2024-08-09T08:36:45Z")

</div>

Gatling version: 3.11.5.2  
Gatling flavour: Oracle Java JDK 21 (GraalVM 21.0.4+8.1)  
Gradle Version: Gradle 8.8  
Gatling Gradle plugin: “io.gatling.gradle” version “3.11.5.2”

Hello Team,

I’m getting below error during running my simulation script before updating,

```auto
Exception in thread "main" java.lang.IllegalArgumentException: Can't use the file DataWriter without setting the results directory
        at io.gatling.core.stats.DataWritersStatsEngine$.$anonfun$apply$2(DataWritersStatsEngine.scala:58)

```

In `gatling.conf`, I have

```auto
 data {
    writers = [console, file] # The list of DataWriters to which Gatling write simulation data (currently supported : console, file, graphite)

```

This was working in the previous gatling version (3.9.0). Any idea what I’m missing?

Thanks in advance.

Ashutosh

---

<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:** [August 9, 2024, 8:49am UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219/2 "2024-08-09T08:49:40Z")

</div>

Of the importance of providing a reproducer as required when posting here.

I’ve just tried our official demo project: [GitHub - gatling/gatling-gradle-plugin-demo-java](https://github.com/gatling/gatling-gradle-plugin-demo-java)  
with Java 21 and gradle 8.8 and it just works.

---

<div class="post-metadata">

**Author:** ![ashutosh.trip](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/ashutosh.trip/32/1557_2.png) [@ashutosh.trip](https://community.gatling.io/u/ashutosh.trip)\
**Post date:** [August 9, 2024, 12:30pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219/3 "2024-08-09T12:30:36Z")

</div>

Hello Stephane, I really appreciate for your quick response.

When I am running my service using below command, I am getting the datawriter error.

```auto
java $DEFAULT_JAVA_OPTS -jar service.jar -s <simulation type>

sleep ${SLEEP_TIME} # sleep for 5 mins to grab gatling reports from pod if desired

```

But when I am running the simulation with gatlingRun command its working fine. What could be the reason for this

```auto
./gradlew gatlingRun --simulation=simulation

```

---

<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:** [August 9, 2024, 12:34pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219/4 "2024-08-09T12:34:43Z")

</div>

Ahhh, so on contrary to what you state in your original message, you’re not running with our gradle plugin, but instead are trying to build a fatjar.

Sorry but we don’t support this usage (and have never supported it, there was never a trace of this in our documentation). Please stick to the official supported launched: the maven, gradle and sbt plugins, the standalone bundle and Gatling Enterprise.

---

<div class="post-metadata">

**Author:** ![ashutosh.trip](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/ashutosh.trip/32/1557_2.png) [@ashutosh.trip](https://community.gatling.io/u/ashutosh.trip)\
**Post date:** [August 9, 2024, 1:08pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219/5 "2024-08-09T13:08:42Z")

</div>

For older version  
Java SDK - 17  
Gatling Gradle - 3.9.2  
Gradle Version - 7.5.1

This same was working fine, but after updating to new version its showing this error.

---

<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:** [August 9, 2024, 1:15pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219/6 "2024-08-09T13:15:54Z")

</div>

Nothing we can do about it. As I wrote: please stick to the documented usage which is the only one supported. If you chose to go in uncharted lands, if it works, fine for you, but if it breaks, you’re on your own.

---

<div class="post-metadata">

**Author:** ![ashutosh.trip](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/ashutosh.trip/32/1557_2.png) [@ashutosh.trip](https://community.gatling.io/u/ashutosh.trip)\
**Post date:** [August 12, 2024, 6:03am UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219/7 "2024-08-12T06:03:38Z")

</div>

Thanks Stephane, I would like to express my gratitude for your prompt response and valuable insights. It is now clear to me that attempting to run Gatling simulations from a fatJar is not a supported practice, and I appreciate you highlighting this fact. I assure you that I will discontinue my efforts to use a fatJar for running Gatling simulations.

Moving forward, I am keen to explore alternative and officially supported methods, especially running Gatling within Docker containers.

Could you please provide me with any official documentation, guidelines, or best practices that the Gatling team has regarding the usage of Docker for executing Gatling simulations? Any recommended Docker images or specific configurations that are proven to work well with Gatling would be immensely helpful.

Thank you once again for your support. I look forward to your guidance and to properly utilizing Gatling in my performance testing workflow.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/gatling2/original/2X/b/b148e0742de35c6280726cabf3ecd3de2d320f63.png) [@system](https://community.gatling.io/u/system)\
**Post date:** [September 11, 2024, 6:03am UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9219/8 "2024-09-11T06:03:43Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
