# Configuring APM Java agent with Spring boot init.d service

**URL:** <https://discuss.elastic.co/t/configuring-apm-java-agent-with-spring-boot-init-d-service/184895>\
**Category:** APM\
**Tags:** java\
**Created:** [June 9, 2019, 9:06pm UTC](https://discuss.elastic.co/t/configuring-apm-java-agent-with-spring-boot-init-d-service/184895 "2019-06-09T21:06:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aprasadh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aprasadh/32/47772_2.png) [@aprasadh](https://discuss.elastic.co/u/aprasadh)\
**Post date:** [June 9, 2019, 9:06pm UTC](https://discuss.elastic.co/t/configuring-apm-java-agent-with-spring-boot-init-d-service/184895/1 "2019-06-09T21:06:59Z")

</div>

I am using the latest ELK stack along with APM. My problem is I want to configure the APM java agent to my spring boot application. Currently I am running the spring boot as init.d service. Does anybody know how to pass `javaagent` parameter in .conf file spring boot init.d service. When I pass using JAVA\_OPTS variable in the .conf, it didn't detect, the application started normally without any trace of javaagent attaching to the spring application.

The java agent is working fine for me when I run my application jar file from command line

---

<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:** [June 11, 2019, 8:41am UTC](https://discuss.elastic.co/t/configuring-apm-java-agent-with-spring-boot-init-d-service/184895/2 "2019-06-11T08:41:31Z")

</div>

Hi and welcome to the forum 🎉

Judging from the Spring Boot documentation, the `JAVA_OPTS` in the `.conf` file seems like the correct place: [https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html#deployment-script-customization-conf-file](https://docs.spring.io/spring-boot/docs/current/reference/html/deployment-install.html#deployment-script-customization-conf-file)

Which Spring Boot version are you using? Could you paste your `.conf` file here? Do other options, like setting the heap size `JAVA_OPTS=-Xmx1024M` work?

---

<div class="post-metadata">

**Author:** ![aprasadh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aprasadh/32/47772_2.png) [@aprasadh](https://discuss.elastic.co/u/aprasadh)\
**Post date:** [June 12, 2019, 11:46am UTC](https://discuss.elastic.co/t/configuring-apm-java-agent-with-spring-boot-init-d-service/184895/3 "2019-06-12T11:46:14Z")

</div>

Thanks @felixbarny for your answer.

It turned out to be a non-issue now. The agent was throwing an error saying it cannot able to connect to APM server(as the remote APM server was down). This error log was written in an another log file under /tmp folder, but the application continued running without an issue. I failed to notice this. Now after the starting the APM, it worked fine. Thanks again.

---

<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:** [July 3, 2019, 7:46am UTC](https://discuss.elastic.co/t/configuring-apm-java-agent-with-spring-boot-init-d-service/184895/4 "2019-07-03T07:46:18Z")

</div>

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