Building your software when using the SDK

When you use the Antithesis Java SDK, you may want to adjust your build/deploy process as follows:

  1. Enable assertion cataloging and coverage instrumentation for your software.
  2. Start your JARs in a specific way.

Enable assertion cataloging

Assertion cataloging is required when using SDK assertions.

Place directories, files, or symlinks to the code you want cataloged in the directory /opt/antithesis/catalog/ within your container image. Generally, this means any .jar and/or .war files.

Antithesis will recursively instrument and catalog all the code in this directory, including any JARs or WARs. Instrumentation and cataloging for separate .class files is not currently supported.

Antithesis will follow symlinks one level deep while resolving the path to the cataloging directory. Do not symlink to a symlink.

Enable coverage instrumentation

Antithesis can automatically instrument compiled Java code by means of bytecode weaving. No changes to your source code or build system are required.

Instrumentation is enabled the same way as assertion cataloging, so if you enabled assertion cataloging, no additional steps are required.

Just remember Antithesis will follow only one symlink deep into each item in /opt/antithesis/catalog/.

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 from opt/antithesis/catalog/more_files.

Antithesis will, by default, act upon every language it supports in the cataloging directory: (Java, Python, JavaScript, .NET), not just Java.

If you need help with instrumentation, contact us at support@antithesis.com or ask on our Discord.

Enable symbolization

Antithesis automatically gathers the symbol information from your code. You don’t need to separately provide symbol files.

Starting your JARs

When running assertion cataloging and instrumentation, Antithesis createa additional dependencies for the application, and inject the 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
  • Introduction
  • How Antithesis works
  • Using Antithesis documentation with AI
  • Get started
  • Test an example system
  • With Docker Compose
  • Build and run an etcd cluster
  • Meet the Test Composer
  • With Kubernetes
  • Build and run an etcd cluster
  • Meet the Test Composer
  • Setup guide
  • For Docker Compose users
  • For Kubernetes users
  • Product
  • Test Composer
  • Test Composer basics
  • Test Composer commands
  • How to check test templates locally
  • How to port tests to Antithesis
  • Test launchers
  • Reports
  • The triage reports
  • Findings
  • Environment
  • Utilization
  • Properties
  • The bug reports
  • Context, Instance, & Logs
  • Bug likelihood over time
  • Logs Explorer & multiverse map
  • Multiverse debugging
  • Overview
  • The Antithesis multiverse
  • Querying with event sets
  • Environment utilities
  • Using the Antithesis Notebook
  • Cookbook
  • Tooling integrations
  • CI integration
  • Discord and Slack integrations
  • Issue tracker integration - BETA
  • Configuration
  • Access and authentication
  • The Antithesis environment
  • Optimizing for testing
  • Docker best practices
  • Kubernetes best practices
  • Concepts
  • Properties and Assertions
  • Properties in Antithesis
  • Assertions in Antithesis
  • Sometimes Assertions
  • Properties to test for
  • Fault injection
  • Reference
  • Webhooks
  • Launching a test
  • Launching a debugging session
  • Webhook parameters
  • SDK reference
  • Define test properties
  • Generate randomness
  • Manage test lifecycle
  • Assertion catalog
  • Coverage instrumentation
  • Go
  • Instrumentor
  • Tutorial
  • Assert (reference)
  • Lifecycle (reference)
  • Random (reference)
  • Java
  • Using the SDK
  • Building your software
  • Tutorial
  • Assert (reference)
  • Lifecycle (reference)
  • Random (reference)
  • C
  • C++
  • C/C++ Instrumentation
  • Tutorial
  • Assert (reference)
  • Lifecycle (reference)
  • Random (reference)
  • JavaScript
  • Python
  • Tutorial
  • Assert (reference)
  • Lifecycle (reference)
  • Random (reference)
  • Rust
  • Instrumentation
  • Tutorial
  • Assert (reference)
  • Lifecycle (reference)
  • Random (reference)
  • .NET
  • Instrumentation
  • Tutorial
  • Assert (reference)
  • Lifecycle (reference)
  • Random (reference)
  • Languages not listed above
  • Assert (reference)
  • Lifecycle (reference)
  • Assertion Schema
  • Handling external dependencies
  • FAQ
  • Product FAQs
  • About Antithesis POCs
  • Release notes
  • Release notes
  • General reliability resources
  • Reliability glossary
  • Techniques for better software testing
  • Autonomous testing
  • Deterministic simulation testing
  • Property-based testing
  • White paper — How much does an outage cost?
  • Catalog of reliability properties for key-value datastores
  • Catalog of reliability properties for blockchains
  • Test ACID compliance with a ring test