Search code examples
javaamazon-elastic-beanstalknewrelicjavaagents

Cannot start Java SE app with -javaagent option on Elastic Beanstalk


I'm trying to get a Java Application to work with New Relic on Elastic Beanstalk. It's a Java app with no New-Relic-supported framework.

The errors reported in the logs are:

Error occurred during initialization of VM
agent library failed to init: instrument

Error opening zip file or JAR manifest missing : /var/app/current/newrelic.jar

The command I use to start is:

java -javaagent:/var/app/current/newrelic.jar -jar target/bs.jar

The layout of my source bundle is as follows:

├── Procfile
├── newrelic.jar
├── newrelic.yml
└── target
    └── bs.jar

It works fine on my local machine, and the app also works fine on Elastic Beanstalk if I remove the -javaagent:... option.

What am I missing?

Thanks,

Val


Solution

  • It was a problem in my build. The newrelic.jar file was corrupted. AFAIK, as of now, there is no problem with this setup.