Elastic apm agent on correto 8 is not starting up

We are using Tomcat 8.5 with Corretto 8 in the beanstalk. I have set all my configs properly, when i am deploying the code i am seeing below errors.

Error opening zip file or JAR manifest missing : /home/ec2-user/elastic-apm-agent-1.36.0.jar
agent library failed to init: instrument

Java_OPS i am using

 -Xmx4256m -javaagent:/home/ec2-user/elastic-apm-agent-1.16.0.jar -Delastic.apm.service_name

Error opening zip file or JAR manifest missing : /home/ec2-user/elastic-apm-agent-1.36.0.jar
agent library failed to init: instrument

This means that the JVM couldn't find the jar at this path: /home/ec2-user/elastic-apm-agent-1.36.0.jar. Please make sure you set your command line properly.
I don't know why the below says: -javaagent:/home/ec2-user/elastic-apm-agent-1.16.0.jar, the error would have been for 1.16.0. I am also not sure if what you provided is trimmed in the middle, or you really didn't set a value to the -Delastic.apm.service_name system property.

This should be an easy fix, it is only a matter of getting the command line right.

i haven't trimmed. This are my JVM_OPTIONS i have configured.

-javaagent:"/var/lib/tomcat/webapps/elastic-apm-agent-1.36.0.jar" -Delastic.apm.service_name=nonprodqa-api -Delastic.apm.server_urls=http://url:8200 -Delastic.apm.environment=nonprodqa

Tomcat is failing to start. with the below error.

Am i missing any quotes here?

Feb 13 05:38:33 ip-10-0-1-5.us-west-2.compute.internal server[6037]: arguments used: start
Feb 13 05:38:33 ip-10-0-1-5.us-west-2.compute.internal server[6037]: Error opening zip file or JAR manifest missing : /var/lib/tomcat/webapps/elastic-apm-agent-1.36.0.jar -Delastic.apm.service_name
Feb 13 05:38:33 ip-10-0-1-5.us-west-2.compute.internal server[6037]: Error occurred during initialization of VM
Feb 13 05:38:33 ip-10-0-1-5.us-west-2.compute.internal server[6037]: agent library failed to init: instrument

I am able to fix the issue with below configuration.

-javaagent:/var/lib/tomcat/webapps/elastic-apm-agent-1.36.0.jar -Delastic.apm.service_name=nonprodqa -Delastic.apm.application_packages=org.example -Delastic.apm.server_urls=http://10.0.1.180:8200

I am not familiar with JVM_OPTIONS, so I cannot say whether this is the right one.
I normally use CATALINA_OPTS, which is appended only when using the startup script with start.

In your last comment there is a bigger problem, where you added the agent to the webapps folder.
The agent jar should never be loaded by the application other than through the -javaagent command! Make sure you move it from the webapps folder and any other folder from which jars are loaded by the app. It should also not be a dependency anywhere in your project.

Please revert all changes you did, move the agent to a separate directory (like /home/ec2-user/elastic-apm-agent-1.36.0.jar) and follow our documentation. This should work. Your errors clearly indicate that the command line that gets built by the startup script is erroneous, so you will have to make sure you get it right.

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