# Unable to remote debug server when APM agent is enabled

**URL:** <https://discuss.elastic.co/t/unable-to-remote-debug-server-when-apm-agent-is-enabled/202821>\
**Category:** APM\
**Tags:** java\
**Created:** [October 9, 2019, 11:26am UTC](https://discuss.elastic.co/t/unable-to-remote-debug-server-when-apm-agent-is-enabled/202821 "2019-10-09T11:26:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [October 9, 2019, 11:26am UTC](https://discuss.elastic.co/t/unable-to-remote-debug-server-when-apm-agent-is-enabled/202821/1 "2019-10-09T11:26:16Z")

</div>

Hi, we're having an issue at the moment where if we startup a server with the APM flag present in the server startup we're not able to remote debug our server. We will get the following error;

![image%20(2)](https://us1.discourse-cdn.com/elastic/original/3X/e/b/ebe0270bf22501d670865b6a9b313ef566f448a1.png)

We've been running with the same config for some months, so unsure what's caused the issue. We've made no changes to the properties file and not changed the APM version that we're using. I was wondering if anyone here has experienced something similar or has any ideas on what the issue may be?

---

<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:** [October 9, 2019, 12:42pm UTC](https://discuss.elastic.co/t/unable-to-remote-debug-server-when-apm-agent-is-enabled/202821/2 "2019-10-09T12:42:50Z")

</div>

This is an unfortunate side-effect of instrumenting a method with Byte Buddy. Sometimes the this reference can't be resolved then. Which method are you trying to debug? This should only occur for a small subset of methods which are instrumented by default by the Java agent.

Are you using the `trace_methods` configuration option? In that case those methods would have the same problem.

See also [https://stackoverflow.com/questions/52067467/byte-buddy-advice-breaks-eclipse-debugger](https://stackoverflow.com/questions/52067467/byte-buddy-advice-breaks-eclipse-debugger) for more details.

---

<div class="post-metadata">

**Author:** ![ethranes](https://avatars.discourse-cdn.com/v4/letter/e/e56c9b/32.png) [@ethranes](https://discuss.elastic.co/u/ethranes)\
**Post date:** [October 9, 2019, 12:59pm UTC](https://discuss.elastic.co/t/unable-to-remote-debug-server-when-apm-agent-is-enabled/202821/3 "2019-10-09T12:59:32Z")

</div>

Thanks for clearing this up Felix, yes in all cases we are using the trace\_methods property. It's not a huge issue for us seeing as we only debug certain servers which are non critical.

Do you know if in this case we'd be able to switch the active flag to false and we'd be able to debug these methods again? Or do we need the server to be started up without including the agent jar?

---

<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:** [October 9, 2019, 2:27pm UTC](https://discuss.elastic.co/t/unable-to-remote-debug-server-when-apm-agent-is-enabled/202821/4 "2019-10-09T14:27:52Z")

</div>

You'd need to restart with `instrument=false` or without the agent flag. I've created a Byte Buddy issue for this: [https://github.com/raphw/byte-buddy/issues/739](https://github.com/raphw/byte-buddy/issues/739)

---

<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:** [October 30, 2019, 10:27am UTC](https://discuss.elastic.co/t/unable-to-remote-debug-server-when-apm-agent-is-enabled/202821/5 "2019-10-30T10:27:53Z")

</div>

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