Java Agent Integration
Java agent is an interceptor in front of the application’s main method. Generally, it is a .jar package statically loaded in the PreMain-Class method, which implements a mechanism of re-defining the running classes' content. Jelastic PaaS allows you to automatically launch such an applet at startup (just after the JVM is initialized).
All of the certified Java stacks by Jelastic runs the jelastic-gc-agent.jar Java agent as a part of the standard optimization. It performs periodical Full GC calls to reduce the memory usage and release unused RAM back to OS. Due to Jelastic contribution to the Java development, similar functionality is natively implemented since the 12th version of JDK.
Refer to the Memory Agent add-on to learn more about Jelastic automatic optimization of the managed Java stacks or use it to optimize any custom Java container.
Follow the next steps to add a custom Java agent into a container:
1. Log in to the Jelastic dashboard with your credentials and click the Config button for the application server in your Java environment:
2. In the opened configuration file manager, you can Upload your Java agent .jar file to any preferable location. Use the Actions list at the top panel (for the current folder) or the context menu when hovering over the particular directory.
Provide a link to the required file or locate it on the local machine to Upload.
3. Next, switch to the variables.conf file (the exact location vary based on the particular software stack) to provide custom variables and JVM options. Here, you can specify the javaagent parameter with a path to the required jar file. For example: javaagent:/opt/tomcat/temp/my-java-agent.jar
Don’t forget to Save the changes with the appropriate button above the editor.
4. To apply the newly added settings, you need to Restart Nodes of your application server layer using the same-named option.
That’s all! Now, your custom Java agent is up and running.