A Java Agent is an interceptor in front of your main method, executed in the same JVM, loaded by the same system classloader and governed by the same security policy and context. We’ll show you how easy it is to set up Java Agent in Jelastic by using New Relic as an example. New Relic is a fanatastic tool to monitor performance and pinpoint problems, all the way down to the code.
So, let’s get started!
1. Create an environment
1. Go to jelastic.com and sign up if you haven’t done so yet, or log in with your Jelastic credentials by clicking the Sign In link on the page.
2. While in Jelastic dashboard, click the Create environment button at the top left.
3. Pick your application server (for example, Tomcat 6) and specify your environment name, for example, newrelic.
Wait just a minute for your environment to be created.
2. Upload New Relic
1. Navigate to newrelic.com and create a free account.
2. Download New Relic agent.
3. Extract files from the zip package you have just downloaded.
4. Go back to Jelastic’s dashboard and upload newrelic.jar and newrelic.yml to the home folder.
5. Open variables.conf file (server folder) and specify the path to jar file according to environment variables:
More information about environment variables can be found here.
Don’t forget to save the changes and restart Tomcat!
Important: Setting New Relic for Jetty isn’t any different from what we did for Tomcat – there’s the variables.conf file that is used for specifying the auxiliary JVM arguments. Installing New Relic for Glassfish is slightly different as instead of variables.conf Glassfish uses domain.xml configuration file. So we can either modify the configuration file, or set the arguments via Glassfish administration console. See this for details: Setting Environment Variables in Glassfish
3. Application deployment
1. Upload your WAR file to Deployment manager.
2. Deploy it to the environment you have created earlier.
3. Start New Relic
Now you can go to New Relic web site, log in and monitor your application.