Error “java.lang.IllegalArgumentException: Comparison method violates its general contract!” observed in GUI.
search cancel

Error “java.lang.IllegalArgumentException: Comparison method violates its general contract!” observed in GUI.

book

Article ID: 319867

calendar_today

Updated On: 04-29-2025

Products

VMware Smart Assurance

Issue/Introduction

Error “java.lang.IllegalArgumentException: Comparison method violates its general contract!” observed in NCM GUI making NCM not useable.

NCM will be accessible only on killing the application forcefully.

Environment

NCM - 10.1.x

Cause

Error “java.lang.IllegalArgumentException: Comparison method violates its general contract!” is a java error thrown (not pertaining to NCM code/functionality) - the sorting algorithm used by java.util.Arrays.sort and (indirectly) by java.util.Collections.sort has been replaced; this new sort implementation may throw an IllegalArgumentException according to third party java databases/internet research (reference link Java_StackOverflow).

Resolution

Log on to the Application Server and update two files ncm-as and powerup.jnlp  

Changes needed in ncm-as:

  • Stop vcmaster services: 
    service vcmaster stop
  • Source the voyence file as 
    source /etc/voyence.conf
  • Take backup of $VOYENCE_HOME/bin/service/ncm-as file.
  • Open $VOYENCE_HOME/bin/service/ncm-as file and in CATALINA_OPTS options, add below flag at the end (before quote’s end):
-Djava.util.Arrays.useLegacyMergeSort=true 
  • Change value of Xmx to 4096 and Xmx to 8192:
CATALINA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.host=127.0.0.1 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.login.config=JmxConfig -Dcom.sun.management.jmxremote.access.file=$TOMCAT_HOME/conf/jmxremote.access -Dcom.sun.management.jmxremote.password.file=$TOMCAT_HOME/conf/jmxremote.password -Djava.util.Arrays.useLegacyMergeSort=true -Djava.rmi.server.useCodebaseOnly=true -Xms2048m -Xmx4096m -XX:+UseParallelGC -XX:NewRatio=2 -XX:+DisableExplicitGC -XX:+HeapDumpOnOutOfMemoryError -XX:+CMSClassUnloadingEnabled -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=1024m -Dorg.apache.activemq.broker.jmx.createConnector=false -Dorg.apache.activemq.SERIALIZABLE_PACKAGES=* -Djava.security.auth.login.config=$TOMCAT_HOME/conf/auth.conf -Djdk.tls.client.protocols=TLSv1.2 -Dorg.apache.catalina.connector.RECYCLE_FACADES=true -Dorg.apache.catalina.connector.response.ENFORCE_ENCODING_IN_GET_WRITER=true -Dorg.apache.catalina.STRICT_SERVLET_COMPLIANCE=true
-Djava.util.Arrays.useLegacyMergeSort=true"
  • Save and exit the file.

 

Changes needed in powerup.jnlp:

  • First, Source the Voyence file:

    source /etc/voyence.conf
  • Add the following line to to the $VOYENCE_HOME/ncmcore/webapps/voyence/powerup.jnlp file​​​​​ 
    <property name="jnlp.java.util.Arrays.useLegacyMergeSort" value="true"/>
  • Save and exit the file.
  • ​​Start the vcmaster service: 
    service vcmaster start

This will resolve the issue.