Skip to main content

GlassFish/ Payara

This guide explains how to instrument a Java application deployed on GlassFish/ Payara server by selecting a Linux agent or Windows agent for trace ingestion.

Prerequisites

  • The Motadata Agent must be installed and running on the server where the GlassFish/ Payara-based application is deployed. Also, the otelcol should be running as part of the Motadata Agent.
    To check the agent status open a Linux terminal and run the below command:
service motadata-agent status
  • Java version must be 8 or higher. To check the version you can use the below command:
java -version
  • The GlassFish/ Payara installation directory (i.e., GlassFish/ Payara_HOME) is available.

  • Required permissions to edit GlassFish/ Payara configuration and restart the domain.

  • Ensure the method used to start GlassFish/ Payara such as:

    • asadmin command, or
    • Domain configuration (domain.xml)
  • Application should be developed on GlassFish/ Payara Framework version 5.x and 6.x.

Configuration Steps

Step1: Register the Application Service in Motadata AIOps

Go to Menu > Settings > APM > Application Registration. Clicking the Application Registration button, you can register a new application.

From the application registration screen, select the instrumentation type Host/VM or Docker.

Java Trace Configuration

FieldDescription
Select AgentSelect the Host/VM where this application is running. You can configure Java application service for both Windows and Linux type agent.
Select LanguageSelect Java from the language icons.
Service NameProvide a unique and meaningful name (e.g., ERP).
Application PathSpecify the application entry path used for the deployment.

Providing these details displays Setup Command to instrument your Java application.

Step2: Configure GlassFish/ Payara for Instrumentation

GlassFish/ Payara instrumentation can be done using different methods. Follow the instructions based on how GlassFish/ Payara is started in your environment using CLI.

Locate asadmin

Find the GlassFish/ Payara admin utility at:

<GlassFish/ Payara_HOME>/bin/asadmin

Replace the <GlassFish/ Payara_HOME> with your directory path.

for example, if GlassFish/ Payara is installed at /opt/GlassFish/ Payara5/ path then,

/opt/GlassFish/ Payara5/bin/asadmin

Stop GlassFish/ Payara Domain

Use the below command to stop the domain:

<GlassFish/ Payara_HOME>/bin/asadmin stop-domain <domainName>

Replace <domainName> with your domain name (for example, domain1).

Add Motadata Java Agent JVM Options

Run the following commands:

<GlassFish/ Payara_HOME>/bin/asadmin create-jvm-options "-javaagent:/motadata/motadata/instrumentation/agents/java/motadata-javaagent.jar"
<GlassFish/ Payara_HOME>/bin/asadmin create-jvm-options "-Dotel.javaagent.configuration-file=/motadata/motadata/config/<ServiceName>.properties"

Replace the <ServiceName> part with the exact service name, you have registered in Motadata AIOps.

Alternatively, you can paste the command snippet copied from the Instrumenting Java Application card. Ensure while pasting, your snippet starts with -javaagent: and ends with .properties".

Start GlassFish/ Payara Domain

Use the below command to start the domain:

<GlassFish/ Payara_HOME>/bin/asadmin start-domain <domainName>

Ensure GlassFish/ Payara starts successfully and the Java agent is loaded without errors.

Step3: Configure Attributes and Parameters

After configuring the application, you can provide the below details:

FieldDescription
Service Attributes(Tags)Add key–value tags to your application for better filtering and organizing data in Explorer. Attribute keys must be in lowercase (for example, apm.env = prod). To add multiple Key-Value pairs you can click the add icon.
Add Custom ParametersAllows you to define custom sampling or tagging parameters for advanced use cases. These optional parameters are passed to the agent (for example, version=4).

Clicking the Apply Configuration button, the ingestion gets started.

Once the Application is Running, you need to verify the below points:

  • Confirm that the service has been registered successfully.
  • On the service registration screen, the Service Trace Collection Status should display "Running."
  • The traces will start appearing in the APM Explorer screen.