# Is it possible / advisable to use APM in my scenario?

**URL:** <https://discuss.elastic.co/t/is-it-possible-advisable-to-use-apm-in-my-scenario/214392>\
**Category:** APM\
**Tags:** java\
**Created:** [January 9, 2020, 9:36am UTC](https://discuss.elastic.co/t/is-it-possible-advisable-to-use-apm-in-my-scenario/214392 "2020-01-09T09:36:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nahojjjen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nahojjjen/32/60536_2.png) [@nahojjjen](https://discuss.elastic.co/u/nahojjjen)\
**Post date:** [January 9, 2020, 9:36am UTC](https://discuss.elastic.co/t/is-it-possible-advisable-to-use-apm-in-my-scenario/214392/1 "2020-01-09T09:36:49Z")

</div>

Hello

I've got a Java desktop application which does not rely on any external server - the application can run independently on each users individual machine. (Think of an application like notepad)

I'd like to gather crash data & stack traces from the users of my app.

I've installed an elastic stack on a server & I attached an apm agent to my local debug snapshot of my application, and this successfully gathers and displays my crash-data in my kibana dashboard for my local debug build.

Is there a good way of including the apm-agent on each user installation?

In my developer-snapshot, I'm including the apm-agent.jar using the run param:  
-J-javaagent: c:/path/to/apm-agent.jar  
However, this makes the application not start if the apm agent isn't found, and ensuring the apm-agent.jar is included in all user installations in a specific folder feels a little unstable, making me wonder if there's another solution I'm supposed to be using?

Thanks in advance for any help & advice.

---

<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:** [January 9, 2020, 9:55am UTC](https://discuss.elastic.co/t/is-it-possible-advisable-to-use-apm-in-my-scenario/214392/2 "2020-01-09T09:55:49Z")

</div>

This installation method would probably be better suited for your use case: [https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-api.html](https://www.elastic.co/guide/en/apm/agent/java/current/setup-attach-api.html)

---

<div class="post-metadata">

**Author:** ![nahojjjen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nahojjjen/32/60536_2.png) [@nahojjjen](https://discuss.elastic.co/u/nahojjjen)\
**Post date:** [January 9, 2020, 10:05am UTC](https://discuss.elastic.co/t/is-it-possible-advisable-to-use-apm-in-my-scenario/214392/3 "2020-01-09T10:05:43Z")

</div>

Thanks for the reply - yes, this direction looks more promising, unfortunately the application uses OSGi containers, which does not seem to be supported with this method. Is there a way around this?

---

<div class="post-metadata">

**Author:** ![Eyal\_Koren](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eyal_koren/32/36830_2.png) [@Eyal\_Koren](https://discuss.elastic.co/u/Eyal_Koren)\
**Post date:** [January 9, 2020, 1:22pm UTC](https://discuss.elastic.co/t/is-it-possible-advisable-to-use-apm-in-my-scenario/214392/4 "2020-01-09T13:22:00Z")

</div>

Indeed, with this method OSGi is not expected to work properly. If you find a configuration option provided by your OSGi framework that lets you define packages you want it to delegate for loading by the application class loader, you may try it out with our base package `co.elastic.apm.agent.*`.

However, it's best if you find a way to use `-javaagent`. If your application is started with a script or a Windows process, you will need to provide a new version of your app, so why can't you make sure that it is appending the `-javaagent` directive to the command line ONLY if the agent jar is bundled?

---

<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:** [January 30, 2020, 9:22am UTC](https://discuss.elastic.co/t/is-it-possible-advisable-to-use-apm-in-my-scenario/214392/5 "2020-01-30T09:22:10Z")

</div>

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