Configuring APM Java agent with Spring boot init.d service

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

Hi and welcome to the forum :tada:

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

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?

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.

1 Like

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