Java instrumentation
The Antithesis platform can automatically instrument compiled Java code by means of bytecode weaving. No changes to your source code or build system are required.
Place directories, files, or symlinks to the code you want instrumented or cataloged in the directory /opt/antithesis/catalog/
within your container image. Antithesis will follow all symlinks while resolving the path to the cataloging directory.
However, it will follow only one symlink deep into each item placed within /opt/antithesis/catalog/
. That is, you should not symlink to a symlink.
Example cataloging directory:
> ln -s /usr/share/my_app /opt/antithesis/catalog
> ls -lAh /opt/antithesis/catalog
lrwxrwxrwx 1 me users 4 Apr 8 17:32 /opt/antithesis/catalog -> /usr/share/my_app
> ls -lAh /opt/antithesis/catalog/
-rwxr-xr-x 1 me users 20K Apr 8 17:33 dotnet_file.dll
lrwxrwxrwx 1 me users 27 Apr 8 17:52 more_files -> /opt/my_project/java_files
-rwxr-xr-x 1 me users 10K Apr 8 17:33 python_script.py
> ls -lA /opt/antithesis/catalog/more_files/
-rw-r--r-- 1 me users 16K Apr 8 17:51 main.jar
lrwxrwxrwx 1 me users 16K Apr 8 17:51 my_other.jar -> /some/other/place.jar
Based on the example above, the following files would be instrumented:
dotnet_file.dll
python_script.py
main.jar
Ignored files:
my_other.jar
- this will be ignored as we already encountered one symlink when traversing down fromopt/antithesis/catalog/more_files
.
Antithesis will recursively instrument all the code in this directory, including any JARs or WARs. Instrumentation and cataloging for separate .class
files is not currently supported.
The instrumentor will, by default, act upon every language it supports in the cataloging directory: (Java , Python, JavaScript, .NET), not just Java.
Starting your JARs
The Antithesis instrumentor will create additional dependencies for the application. Antithesis injects these dependency JARs at the same path as the main application JAR, so you will need to add that folder to your classpath.
For example, if you are starting the app in /opt/app/bin/sample_app.jar
, then we will require /opt/app/bin/*
to be on the classpath.
This means invoking your app JAR like:
java -ea -cp "/opt/app/bin/*" com.your_org.sample_app.controller.Method
This ensures that you are scanning the classpath that includes the Antithesis-injected dependencies, as well as invoking the main program method.
The following invocation will not work:
java -jar /opt/app/bin/sample_app.jar
Symbolization
Antithesis will automatically gather the symbol information from your code. You do not need to separately provide us with symbol files.
Help
Contact us if you need help with this.