NoClassDefFoundError: Could not initialize class com.aspose.tasks.private_.Collections.Comparer - Environment-specific issue

Hello Aspose Support Team,

We are the developers of BigTemplate, a project management application for Jira that uses Aspose.Tasks for MPP export functionality. We have encountered an environment-specific issue with Aspose.Tasks that we cannot reproduce in our development/test environments.

One of our customers is experiencing a NoClassDefFoundError when attempting to export to MPP format on a specific Jira instance, while the same operation works successfully on other Jira instances running on the same physical server with identical environment configuration.

Environment:

  • Jira Version: 9.12.12
  • Java Version: 11.0.12
  • Aspose.Tasks Version: 23.2 (classifier: jdk18)

The error occurs during Project object initialization:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.aspose.tasks.private_.Collections.Comparer
	at com.aspose.tasks.private_.bb.af$a.c(Unknown Source)
	at com.aspose.tasks.private_.bb.af$a.a(Unknown Source)
	at com.aspose.tasks.private_.bb.af$a.b(Unknown Source)
	at com.aspose.tasks.private_.bb.af.a(Unknown Source)
	at com.aspose.tasks.private_.bb.af.toString(Unknown Source)
	at com.aspose.tasks.private_.bb.ag.a(Unknown Source)
	at com.aspose.tasks.BuiltInProjectProperty.<init>(Unknown Source)
	at com.aspose.tasks.BuiltInProjectPropertyCollection.a(Unknown Source)
	at com.aspose.tasks.BuiltInProjectPropertyCollection.e(Unknown Source)
	at com.aspose.tasks.BuiltInProjectPropertyCollection.<init>(Unknown Source)
	at com.aspose.tasks.Project.<init>(Unknown Source)
	at com.aspose.tasks.Project.<init>(Unknown Source)
	at com.aspose.tasks.Project.<init>(Unknown Source)
	at com.aspose.tasks.Project.<init>(Unknown Source)
	at com.aspose.tasks.Project.<init>(Unknown Source)

The error occurs at the very first line when creating a new Project instance:

Project project = new Project(inputStream);

Full code context:

import com.aspose.tasks.Project;
import com.aspose.tasks.ImageSaveOptions;
import com.aspose.tasks.SaveFileFormat;

public void convertToImage(InputStream sourceStream, OutputStream targetStream) throws Exception {
    try (InputStream inputStream = sourceStream) {
        Project project = new Project(inputStream); // <-- Fails here
        project.save(targetStream, createOptions());
    }
}

What makes this particularly puzzling:

  • We cannot reproduce this issue in our development or test environments with the same Java version
  • The issue affects only one Jira instance, while other instances on the same server work correctly
  • Other Aspose libraries (specifically Aspose.Cells) work without issues in the same environment
  • The error suggests that the Collections.Comparer class fails during static initialization, not due to missing dependencies at runtime

Could you advise what system resources, permissions, or dependencies (such as native libraries or fonts) are typically required by Aspose.Tasks—specifically for static initialization like in the Collections.Comparer class? Are there recommended diagnostic steps or debug flags we could use to pinpoint what might be going wrong in this particular Jira instance, given that identical instances on the same server do not encounter this problem?

Additionally, if you have seen similar cases before or can suggest targeted workarounds (e.g., JVM or system properties, configuration tweaks), we would appreciate any input to help resolve this for our customer as quickly as possible.

We are available to provide additional diagnostic information or logs if needed. Since this affects a production customer environment, any guidance would be greatly appreciated.

Thank you for your assistance.

Best regards,
BigPicture Engineering Team

@BigPictureAppfire

The NoClassDefFoundError you’re encountering during the initialization of the Project object in Aspose.Tasks can be quite challenging, especially since it only occurs in a specific Jira instance. Here are some potential causes and diagnostic steps to troubleshoot this issue:

  1. Class Loading Issues: The error indicates that the Comparer class could not be initialized, which may be due to classpath issues or conflicts with other libraries. Ensure that there are no conflicting versions of Aspose.Tasks or other libraries in the classpath.

  2. JVM Configuration: Review the JVM options for the Jira instance where the error occurs. Specific JVM flags or memory settings can impact class loading. Compare the JVM options between the working and non-working instances to identify discrepancies.

  3. Permissions: Verify that the Jira instance has the necessary permissions to access all required libraries and resources. Security policies may restrict access to certain classes or resources.

  4. Native Libraries: While Aspose.Tasks typically does not require native libraries, ensure that any indirectly required dependencies are available and correctly configured.

  5. Diagnostic Logging: Enable detailed logging for the Jira instance to capture more information about the environment and the state of the application when the error occurs. This may provide insights into the underlying issue.

  6. Environment Differences: Since the issue is environment-specific, check for any differences in environment variables, system properties, or configurations between the working and non-working instances.

  7. Update Aspose.Tasks: If feasible, consider updating to a newer version of Aspose.Tasks, as there may have been bug fixes or improvements that could resolve this issue.

If you continue to face difficulties, providing additional diagnostic information or logs could help in pinpointing the issue further.

Feel free to reach out if you need further assistance!

@BigPictureAppfire ,
we will review source code of com.aspose.tasks.private_.Collections.Comparer and return with the answer.