Java

Environment Variables

The key to getting Qtap working with Java is setting the correct environment variables. There are two important variables to set:

  1. QPOINT_STRATEGY: This should be set to "forward" for Qtap's forwarding mode.

  2. TRUST_STORE: This should point to the Java trust store location.

Locate the Java Trust Store

The location of the trust store can vary depending on your Java version. You're looking for the path to cacerts. Here's how to find it:

  • For OpenJDK, it's typically located at: /usr/local/openjdk-<version>/lib/security/cacerts

    Replace <version> with your Java version number (e.g., 17, 11, etc.)

  • For Oracle Java, it's usually at: $JAVA_HOME/jre/lib/security/cacerts

Update Your Environment

Modify your environment to include the necessary environment variables. Here's an example of a Dockerfile:

# Use a base image with the specified Java version
ARG JAVA_VERSION=17
FROM openjdk:${JAVA_VERSION}-slim

# Set Strategy
ENV QPOINT_STRATEGY=forward
ENV TRUST_STORE=/usr/local/openjdk-17/lib/security/cacerts

# ... rest of your Dockerfile

Make sure to adjust the TRUST_STORE path if you're using a different Java version or distribution.

Deploy Qtap

Ensure Qtap is deployed and running in your environment. You can do this using the Docker or Kubernetes deployment methods described in the Qtap documentation.

Deploy Your Java Application

With Qtap running and the environment variables set, you can now deploy your Java application. The application will use the environment variables to properly interact with Qtap.

Your Java application must come online after Qtap! Redeploying the app may be necessary.

Verify the Setup

After deploying your Java application, you can verify that it's properly using Qtap by checking the Qtap logs or monitoring interface for traffic from your Java application.

Troubleshooting

If you encounter issues:

  1. Double-check that the TRUST_STORE path is correct for your Java version and distribution.

  2. Ensure Qtap is properly deployed and running before starting your Java application.

  3. Check the Qtap logs for any error messages related to the Java application's connections.

Remember, you may need to adjust these instructions slightly based on your specific Java version, distribution, and deployment environment.

Last updated