# 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/9045>\
**Category:** Gatling (Open-Source)\
**Created:** [June 3, 2024, 9:29pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9045 "2024-06-03T21:29:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pujitha](https://avatars.discourse-cdn.com/v4/letter/p/7cd45c/32.png) [@pujitha](https://community.gatling.io/u/pujitha)\
**Post date:** [June 3, 2024, 9:29pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9045/1 "2024-06-03T21:29:04Z")

</div>

Gatling version: 3.11.3  
Gatling flavour: Java JDK 11.0.11  
Gatling build tool: maven 3.9.7  
Gatling maven plugin: 4.9.0

Hello Team,

My apology first, this might be a very silly mistake of mine somewhere, I’m getting below error during standalone execution after packaging.

```console
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.

-Pujitha

---

<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:** [June 3, 2024, 9:38pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9045/2 "2024-06-03T21:38:32Z")

</div>

You mentioned that you’re using maven, but you also mentioned “standalone execution after packaging”.  
Are you using a supported workflow, meaning launching with our maven plugin, or do you go with a custom workflow?

You can verify for yourself that our [official demo project](https://github.com/gatling/gatling-maven-plugin-demo-java) works out of the box, so I suspect the latter. If so, please stick to the supported workflows. “standalone execution after packaging” is only supported in Gatling Enterprise.

---

<div class="post-metadata">

**Author:** ![pujitha](https://avatars.discourse-cdn.com/v4/letter/p/7cd45c/32.png) [@pujitha](https://community.gatling.io/u/pujitha)\
**Post date:** [June 4, 2024, 8:36pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9045/3 "2024-06-04T20:36:06Z")

</div>

Thanks for your reply Stéphane.

I’m using gatling-maven-plugin-demo for my PoC. The only changes I did there was I included resources, added maven-shade-plugin and set execution goals in gatling-maven-plugin in pom.  
So it still follows the workflow I guess.

This is how my updated pom looks on the gatling-maven-plugin-demo-java.

And I run the jar in target using below command after compile.  
` java -jar gatling-maven-plugin-demo-java-3.11.3.jar -s computerdatabase.ComputerDatabaseSimulation`

```auto
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>io.gatling.demo</groupId>
  <artifactId>gatling-maven-plugin-demo-java</artifactId>
  <version>3.11.3</version>

  <properties>
    <maven.compiler.release>11</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <gatling.version>${project.version}</gatling.version>
    <gatling-maven-plugin.version>4.9.4</gatling-maven-plugin.version>
    <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
    <maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
    <maven-jar-plugin.version>3.4.1</maven-jar-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
<!-- <scope>test</scope>-->
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src/test/java</sourceDirectory>

    <resources>
      <resource>
        <directory>src/test/resources</directory>
        <includes>
          <include> **/** </include>
        </includes>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>${maven-resources-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-maven-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!-- Enterprise Cloud (https://cloud.gatling.io/) configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/maven_plugin/#working-with-gatling-enterprise-cloud -->
          <!-- Enterprise Self-Hosted configuration reference: https://gatling.io/docs/gatling/reference/current/extensions/maven_plugin/#working-with-gatling-enterprise-self-hosted -->
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
          <filters>
            <filter>
              <artifact>*:*</artifact>
              <excludes>
                <exclude>META-INF/*.DSA</exclude>
                <exclude>META-INF/*.SF</exclude>
                <exclude>META-INF/*.RSA</exclude>
              </excludes>
            </filter>
          </filters>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <transformers>
                <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <mainClass>io.gatling.app.Gatling</mainClass>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>
</project>

```

---

<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:** [June 4, 2024, 10:22pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9045/4 "2024-06-04T22:22:19Z")

</div>

The only workflows we support are the ones described in our documentation.  
Shading is definitely not in there.

As I explained, this is a workflow we support in Gatling Enterprise.

---

<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:** [June 4, 2024, 10:22pm UTC](https://community.gatling.io/t/getting-error-cant-use-the-file-datawriter-without-setting-the-results-directory/9045/5 "2024-06-04T22:22:23Z")

</div>


