Hi,
I was about to update GroupDocs.Comparison for Java to version 26.8, as it should fix a bug I reported earlier. However, the new version crashes when a metered license key is provided.
AI analysis below.
GroupDocs.Comparison for Java 26.8: metered license activation throws IllegalAccessError
Summary
Metered.setMeteredKey crashes with a message-less java.lang.IllegalAccessError on GroupDocs.Comparison for Java 26.8. Version 25.2 works with the same keys and environment. The cause is a resource path that the jar’s shading step did not relocate, so the failure is in the released artifact itself, not in user code or the JVM setup.
Environment
- groupdocs-comparison 26.8 (Maven, from releases.groupdocs.com/java/repo/)
- Java 21 (reproduced on Temurin 21.0.11 Linux x64 and 21.0.12.1 macOS arm64)
- Valid metered license keys
Stack trace
Caused by: java.lang.IllegalAccessError
at com.groupdocs.comparison.internal.c.a.t.rr.a(Unknown Source)
at com.groupdocs.comparison.internal.c.a.t.rr.<clinit>(Unknown Source)
at com.groupdocs.comparison.internal.c.a.t.Mm.<clinit>(Unknown Source)
at com.groupdocs.comparison.internal.c.a.t.bX.setLicense(Unknown Source)
...
at com.groupdocs.comparison.license.License.BiV(Unknown Source)
at com.groupdocs.comparison.license.Metered.setMeteredKey(Unknown Source)
Root cause
Disassembling com.groupdocs.comparison.internal.c.a.t.rr (the shaded Aspose.Tasks licensing class) shows its static initializer reading 20 bytes at offset 315 from a classpath resource whose path is assembled from a byte array at runtime. The bytes decode to:
/com/aspose/tasks/resources/New project 2010.zip
The 26.8 jar ships this file only at the relocated path com/groupdocs/comparison/internal/c/a/t/resources/New project 2010.zip. Because the original path is built from bytes instead of a string constant, the relocation step could not rewrite it. getResourceAsStream returns null, the resulting NPE is caught, and the catch block rethrows new IllegalAccessError() with no message.
Reproduction
import com.groupdocs.comparison.license.Metered;
public class Repro {
public static void main(String[] args) {
// Valid metered keys are required: with invalid keys the call fails earlier
// ("Authentication failed") and never reaches the broken code path.
new Metered().setMeteredKey("<valid public key>", "<valid private key>");
}
}
On 26.8 this throws the IllegalAccessError above after authentication succeeds. On 25.2 the same call succeeds.
Workaround
Copy com/groupdocs/comparison/internal/c/a/t/resources/New project 2010.zip out of the jar and place it on the application classpath at com/aspose/tasks/resources/New project 2010.zip. License activation and document comparison then work normally.
Suggested fix
Ship the resource at the path the licensing code reads, or rewrite the dynamically built path during relocation.