# Java Agent for a Tomcat JVM

**URL:** <https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197>\
**Category:** APM\
**Created:** [February 13, 2019, 11:27am UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197 "2019-02-13T11:27:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oliv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oliv/32/111867_2.png) [@Oliv](https://discuss.elastic.co/u/Oliv)\
**Post date:** [February 13, 2019, 11:27am UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/1 "2019-02-13T11:27:26Z")

</div>

Hi,

I'm trying to pass the jar file with a properties file. As I understood that this was possible.  
The properties file is in the same folder and named elasticapm.properties.  
How can I pass this file at the startup of my Tomcat.

Br,

---

<div class="post-metadata">

**Author:** ![Wolfram\_Haussig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wolfram_haussig/32/70528_2.png) [@Wolfram\_Haussig](https://discuss.elastic.co/u/Wolfram_Haussig)\
**Post date:** [February 13, 2019, 11:51am UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/2 "2019-02-13T11:51:43Z")

</div>

Hello,

We use the java agent in version 1.3 and this is what we added to the startup.sh file:

> JAVA\_OPTS="$JAVA\_OPTS -javaagent:/home/tomcat/apm-agent/elastic-apm-agent-1.3.0.jar "  
> export JAVA\_OPTS

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [February 13, 2019, 12:48pm UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/3 "2019-02-13T12:48:00Z")

</div>

Hi and thanks for checking out Elastic APM 🙂

The `elasticapm.properties` is only for the configuration settings of the agent and does not replace setting the `-javaagent` argument. See also [https://www.elastic.co/guide/en/apm/agent/java/master/configuration.html](https://www.elastic.co/guide/en/apm/agent/java/master/configuration.html)

You can find tomcat installation instructions here: [https://www.elastic.co/guide/en/apm/agent/java/master/setup-javaagent.html#setup-tomcat](https://www.elastic.co/guide/en/apm/agent/java/master/setup-javaagent.html#setup-tomcat)

Cheers,  
Felix

---

<div class="post-metadata">

**Author:** ![Oliv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oliv/32/111867_2.png) [@Oliv](https://discuss.elastic.co/u/Oliv)\
**Post date:** [February 13, 2019, 2:01pm UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/4 "2019-02-13T14:01:17Z")

</div>

Hi,  
Found out how to pass the configuration file. Used -Delastic.apm.configuration=file: in my tomcat options to make it work.  
Thx Felix for the information, But just missed the info about the configuration file

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [February 13, 2019, 4:09pm UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/5 "2019-02-13T16:09:09Z")

</div>

> [@Oliv](#):
>
> Used -Delastic.apm.configuration=file: in my tomcat options to make it work.

This is not an option I'm aware of. Where did you read about that?

You have to put the `elasticapm.properties` file in the same directory where the agent jar is in.

---

<div class="post-metadata">

**Author:** ![Oliv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oliv/32/111867_2.png) [@Oliv](https://discuss.elastic.co/u/Oliv)\
**Post date:** [February 14, 2019, 10:11am UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/6 "2019-02-14T10:11:48Z")

</div>

Tomcat configuration files are modified to start our application.  
In order to not screw up things I modified it directy in the registry.  
Checked out the other startup option where I found that.  
The file was in th same directory since the beginning I tested, it has been picked up since I putted this in the startup options.

---

<div class="post-metadata">

**Author:** ![felixbarny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felixbarny/32/27341_2.png) [@felixbarny](https://discuss.elastic.co/u/felixbarny)\
**Post date:** [February 14, 2019, 10:51am UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/7 "2019-02-14T10:51:21Z")

</div>

> [@Oliv](#):
>
> Checked out the other startup option where I found that.

Do you have a link at hand?

---

<div class="post-metadata">

**Author:** ![Oliv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/oliv/32/111867_2.png) [@Oliv](https://discuss.elastic.co/u/Oliv)\
**Post date:** [February 14, 2019, 11:02am UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/8 "2019-02-14T11:02:44Z")

</div>

Sorry Felix, Was talking about the other startup options set in the registry for Tomcat.

I'll try to inform where our R&D found these informations.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 7, 2019, 7:02am UTC](https://discuss.elastic.co/t/java-agent-for-a-tomcat-jvm/168197/9 "2019-03-07T07:02:48Z")

</div>

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