Error:Could not find or load main class elastic.war . While using elasticsearch APM

Hey,
I am connecting elastic apm with spring boot application, I am able to connect my application with .jar file, but now when I am trying it with .war file I am not able to do it due to the following errors.
When I am running this command I am getting this error.

java -javaagent:/home/abcd/Desktop/elastic-apm/apm-agent-attach-1.5.0/elastic-apm-agent.jar -war spring-mvc-example.war
getting this error.

Unrecognized option: -war
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

And when I am running this command
java -javaagent:/home/abcd/Desktop/elastic-apm/apm-agent-attach-1.5.0/elastic-apm-agent.jar spring-mvc-example.war

Getting this error

2019-06-11 14:57:24.477 [apm-server-healthcheck] INFO co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is available: {"ok":{"build_date":"2019-03-21T14:28:17Z","build_sha":"56b4ebe0088c9a15ea5eb5f4d491da19f08c1bc6","version":"6.7.0"}}
2019-06-11 14:57:24.564 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.5.0 as war on Java 1.8.0_191 (Oracle Corporation) Linux 3.10.0-862.el7.x86_64
2019-06-11 14:57:24.565 [main] WARN co.elastic.apm.agent.configuration.StartupInfo - To enable all features and to increase startup times, please configure application_packages
Error: Could not find or load main class spring-mvc-example.war

Kindly guide.
Thanks.

A war is something meant to be deployed in a Web Server like Tomcat for example (WAR mean Web ARchive). It is not meant to be run as a jar unless it has also an embedded main jar.

Okay,
I'll try with that.
Thanks,

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