Skip to main content

Try CET - Find and fix Java exceptions

This demo introduces Harness CET's functionality by discussing different types of Java exceptions that you come across and how to fix them.

There are three types of Java exceptions:

  • Uncaught exceptions: Exceptions that the compiler doesn't catch. Instead, the built-in exception handler in Java automatically catches and handles them.

  • Caught exceptions: Exceptions that are handled in code via the try and catch keywords.

    try {
    // Block of code to try
    catch(Exception e) {
    // Block of code to handle errors
  • Swallowed exceptions: Exceptions that are caught in empty catch blocks. They don't show up in logs. They are difficult to identify and troubleshoot, resulting in production incidents.

Dealing with exceptions - A repeatable process

Even though it is difficult to remove all the exceptions, it is important to identify the problematic exceptions and prevent them from escaping into production, because they can negatively impact users. You can use a three-step process to identify, resolve, and prevent bad exceptions.

  1. Identify critical issues: Proactively identify runtime exceptions and slowdowns in every release including issues that swallowed exceptions. It's important to know when the new releases introduce new, increasing, or resurfaced exceptions.
  2. Resolve using complete context: Reproduce any exception or slowdown with the complete source code, variables, DEBUG logs, and environment state. You need purpose-built tools such as Harness Java Exception Tracker to do this. After you get the context, fix all the exceptions, even if they are not logged.
  3. Prevent exceptions using a Java Exception Tracker: You need to identify the exceptions every time the code is checked in and collect the logs required to fix the exceptions. However, static analysis and testing do not detect all the issues. You can use a Java Exception Tracker to perform runtime code analysis that identifies unknown issues and prevents them from being deployed.

Set up reliability gates by integrating a Java Exception Tracker with your CI/CD pipelines. This automatically blocks deployment of unreliable software versions. Implement this throughout the software delivery life cycle, starting from unit testing to production.

You can use the Java Exception Tracker as a standalone application or integrate it with your CI/CD pipelines. It is easy to set up and get started with standalone Java Exception Trackers. CI/CD-integrated Java exception tools are complex and take more time to install, but they have the potential to become an integral part of your software delivery process.

Java Exception Tracker features

It is critical to have the right Java Exception Tracker so that the exceptions don't skip through your software delivery life cycle. Your Java Exception Tracker should have the following features:

  • Code fingerprinting: The Java Exception Tracker should have the ability to analyze the code loaded into your Java Virtual Machine (JVM) during runtime and assign a unique fingerprint to each line in the code. At runtime, the tracker should correlate each error, drill down to its unique signature, identify anomalies, and capture the complete state.
  • Source code and variables: The tracker should have the ability to analyze and index the code structure. This helps you collect data on the most relevant variable state from the running JVM when an event occurs. The tracker should capture data across the call stack up to 10 levels into heap.
  • DEBUG/TRACE logs: The tracker should have highly efficient cyclical in-memory buffers to store log statements and display the DEBUG/TRACE state of your code during the critical events, without increasing log verbosity or parsing log files from disk.
  • Error detection and prioritization: The Java Exception Tracker should have the capability to correlate all the code events at runtime to their unique fingerprint, even as code changes over time. It should identify and prioritize new and spiking errors without relying on the developer's foresight to log and search them.
  • Host/Container state: The tracker should capture detailed system metrics, such as CPU, GC, and so on, of the host or container in which the code is executing. It should also capture complete snapshots of the JVM state, such as env vars and threading state, in the event of critical errors and slowdown.
  • 256-bit AES encryption: The tracker should have the ability to privately encrypt all the source code and the collected variable states using a 256-bit AES Encryption key before they leave the production node.
  • Personally Identifiable Information (PII) redaction: You must always secure sensitive data at all times. The Java Exception Tracker should provide you the ability to redact the PII variable data before it leaves the user environment. You should ensure that the variable state is redacted based on the configurable variable value patterns and code symbology, such as variable, field, and class names.

Use CET to identify, resolve, and prevent Java exceptions

This video shows how you can use the Harness Error Tracking Java Agent to identify, resolve, and prevent Java exceptions.

Interactive demo - Harness Error Tracking Java Agent

This interactive demo demonstrates the capabilities of the Harness Error Tracking Java Agent. Select the glowing circle to see the capabilities.

Try it for yourself

To learn how you can install the Harness Error Tracking Agents for your Harness account, go to Set up Continuous Error Tracking.

To learn more about CETs capabilities and see more demos, contact Harness.