Aspose Font Java 25.x not working due to missing class com/aspose/font/internal/util/logging/Logger

We were trying to update to the latest Aspose version, including Aspose Font 25.6.

When trying to load the license via

try (final var is = AsposeLicense.class.getClassLoader().getResourceAsStream("Aspose.Total.lic")) {
  new com.aspose.font.License().setLicense(is);
}

We get the error

java.lang.NoClassDefFoundError: com/aspose/font/internal/util/logging/Logger

When I go to Aspose Repository Browser /java/repo/com/aspose/aspose-font/25.6/ and open the
aspose-font-25.6.jar, I can see the following:

  • The file com/aspose/font/License.class accesses com/aspose/font/internal/util/logging/Logger
  • There is no such directory om/aspose/font/internal/util in the JAR file.

Could it be you forgot to include the relevant classes in your build process? Can you please check?

PS: In the previous 24.x release, com/aspose/font/License.class uses java/util/logging/Logger for logging, so this appears to have been a recent change in 25.x.

image.jpg (276.8 KB)

@ximaawa

Hello,

Thank you for reaching out to us regarding the issue you’re experiencing with Aspose.Font for Java 25.x.

The error you’re encountering, java.lang.NoClassDefFoundError: com/aspose/font/internal/util/logging/Logger, suggests that the necessary logging class is not present in the JAR file.

Steps to Resolve the Issue

1. Verify your Project Dependencies

Ensure that your project has the correct dependencies. Here’s an example pom.xml for Maven:

<dependency>
  <groupId>com.aspose</groupId>
  <artifactId>aspose-font</artifactId>
  <version>25.6</version>
</dependency>

2. Download and Reinstall

Sometimes, the issue could be due to a corrupted JAR file. Try deleting the current JAR file and re-downloading it. Ensure you’re downloading the correct version from the Aspose official website.

3. Verify Classpath

Make sure that the classpath includes all the necessary dependencies. For framewoks like Maven, ensure there are no version conflicts in pom.xml.

<dependency>
  <groupId>com.aspose</groupId>
  <artifactId>aspose-font</artifactId>
  <version>25.6</version>
  <classifier>jdk16</classifier> <!-- If you are using JDK 16 -->
</dependency>

4. Update Java Development Kit (JDK)

Ensure that you are using a JDK compatible with Aspose.Font. We recommend using the latest version of Java, unless there’s a specific requirement to stay on an older version.

Example Code

Here is a sample code snippet to correctly set the license:

import com.aspose.font.License;

public class Main {
    public static void main(String[] args) {
        try (final var is = Main.class.getClassLoader().getResourceAsStream("Aspose.Total.lic")) {
            new License().setLicense(is);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

References:

Next Steps

If the problem persists after completing these steps, please share more details about your development environment, including:

  • Java version
  • IDE and build tool (Maven/Gradle/Eclipse, etc.)
  • Complete stack trace

This additional information will help us diagnose the issue further and provide a more tailored solution.

We appreciate your patience and cooperation.

Best regards,

It’s just an AI bot, but regarding the suggestions:

Verify your Project Dependencies, Download and Reinstall

I downloaded the JAR file directly from Aspose Repository Browser /java/repo/com/aspose/aspose-font/25.6/, it does not contain the missing class file. Unless it is contained in another Maven artifact, but I don’t think so, since it’s in the com/aspose/aspose-font package.

Verify Classpath, Update Java Development Kit

Seems irrelevant, since as mentioned, the class file is referenced, but nowhere to be found within the JAR.

@ximaawa

We have opened an investigation ticket as FONTJAVA-69 in our issue management system to further dig into this scenario. All the details have been provided under the ticket and as soon as we make some progress towards its resolution, we will surely inform you via this forum thread. We really are sorry for the inconvenience faced.