Java Error: "Comparison method violates its general contract in OneClick Interfaces tab" - Spectrum JNLP Thick Client
search cancel

Java Error: "Comparison method violates its general contract in OneClick Interfaces tab" - Spectrum JNLP Thick Client

book

Article ID: 443488

calendar_today

Updated On:

Products

Network Observability Spectrum

Issue/Introduction

When loading the Interfaces tab for a device with a large number of interfaces in DX NetOps Spectrum OneClick, the application may fail to display data and throw a Java exception.

The OneClick client console displays the following error message:" java.lang.IllegalArgumentException: Comparison method violates its general contract!"
This typically occurs when sorting large tables (such as the Interfaces tab) where the underlying Java sorting algorithm (TimSort) encounters an inconsistent comparison logic.

Environment

    •    Product: DX NetOps Spectrum
    •    Version: 24.3.x
    •    Component: OneClick Console (JNLP)
    •    Java Version: Problem seen with JRE 17.0.12

Cause

This is a known behavior in newer Java runtimes where the legacy merge sort was replaced by a stricter sorting algorithm. If the comparison logic in the application does not strictly adhere to transitivity, Java throws this exception.

Resolution

This issue is no longer seen in Spectrum 25.4.4 and higher with JRE 17.0.17.

Additional Information

Workaround

To resolve this issue, force the OneClick client to use the legacy merge sort algorithm by modifying the oneclick.jnlp file on the OneClick server.

  1. Log into the OneClick server.
  2. Navigate to the following directory:
    • Windows: <$SPECROOT>/tomcat/webapps/spectrum/
    • Linux: $SPECROOT/tomcat/webapps/spectrum/
  3. Create a backup of the oneclick.jnlp file.
  4. Open oneclick.jnlp in a text editor.
  5. Locate the <resources> section and find the java-vm-args attribute within the j2se element.
  6. Add the following argument to the existing list: -Djava.util.Arrays.useLegacyMergeSort=true
    Example:
    xml


    <j2se version="17.0.12_00" java-vm-args="-Xmx1024m -Djava.util.Arrays.useLegacyMergeSort=true"/>


  7. Save the file and restart the OneClick client.