We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Facing java.lang.NoClassDefFoundError while calling Table.autofit() api

Hi,
We are facing a java.lang.NoClassDefFoundError-(initialization failure) error when our application code calls the Table.autofit() api.

The application is running in windows environment with IBM JRE8. The aspose version is. 17.7.1 words java. Here’s the exception stacktrace:
asposewobfuscated.zzAA (initialization failure)
java.lang.NoClassDefFoundError: asposewobfuscated.zzAA (initialization failure)
_ at java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:96)_
_ at asposewobfuscated.zzC9.zzT(Unknown Source)_
_ at asposewobfuscated.zzCA.zzRd(Unknown Source)_
_ at asposewobfuscated.zzRO.zzZ(Unknown Source)_
_ at asposewobfuscated.zzS8.zzRg(Unknown Source)_
_ at asposewobfuscated.zzS8.zzT(Unknown Source)_
_ at asposewobfuscated.zzS8.zzU(Unknown Source)_
_ at com.aspose.words.FontSettings.zzU(Unknown Source)_
_ at com.aspose.words.zz9M.zzS(Unknown Source)_
_ at com.aspose.words.zz9M.zzR(Unknown Source)_
_ at com.aspose.words.zz9M.zzZ(Unknown Source)_
_ at com.aspose.words.zz9M.zzZ(Unknown Source)_
_ at com.aspose.words.zz9M.zzX(Unknown Source)_
_ at com.aspose.words.zzZ88.zz0(Unknown Source)_
_ at com.aspose.words.zzYVP.zzZ(Unknown Source)_
_ at com.aspose.words.zzYVP.zzP(Unknown Source)_
_ at com.aspose.words.zzYVP.zzZfO(Unknown Source)_
_ at com.aspose.words.zzYVP.zzZfP(Unknown Source)_
_ at com.aspose.words.Table.zzZgJ(Unknown Source)_
_ at com.aspose.words.Table.autoFit(Unknown Source)_

  • The error is giving ‘initialization failure’ as the cause. Is there any external setting/configuration/file missing in the environment which is causing the initialization to fail? Does the FontSettings instance expect such setting/configuration/file?
  • Can such issue occur due to the presence of another Aspose jar being loaded in the environment(specifically v17.11)
  • Providing a code snippet to reproduce the issue is difficult here. Can the developers check the implementation and help us here with the expected settings?

Thanks.

@Akash007

Please note that Aspose.Words does not need any external setting/configuration neither FontSettings instance.

You are facing java.lang.NoClassDefFoundError exception. This exception in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time.

Please grant full permission to Aspose.Words’ Jar where you are using it. Hope this helps you.

Could you please share which other Aspose product you are using with Aspose.Words?

Unfortunately, it is difficult to say what the problem is without input document and code example. We need your document and code example to test this case.

We suggest you please try the latest version of Aspose.Words for Java 19.11. Hope this helps you.

@tahir.manzoor
I understand that there is something missing which JVM couldn’t find. We are trying to figure out what exactly it is.
Here’s what I read about ‘initialization failure’ message which comes with NoClassDefFoundError’:
"The “(initialization failure)” means that the static initializer ("<clinit>") method of the class previously threw an unchecked exception. When this occurs, the JVM marks the class as bad, and subsequent attempts to use or access the class result in NoClassDefFoundError. Search your logs for errors that include “Reason.<clinit>” in the stack trace to find the underlying cause.

(In general, the NoClassDefFoundError should include a “Caused by” with the exception that occurred in the static initializer, but for some reason, the cause either wasn’t present or you didn’t include it in your stack trace.) "

In this case, the aspose stacktrace doesn’t mention the actual cause behind the error. Can someone from Aspose team predict the probable cause by investigating the stacktrace?

aspose-words-17.11.jar(java) exists together with aspose-words-17.7.1.jar(java)

Btw, can we have some sort of details on the package asposewobfuscated ? Like what is its purpose? I see that it has been completely removed since the last few versions.
I also see that there have been similar issues posted around the same package…

@Akash007

You referred to very old threads. Your issue seems to be related to permission. You need to use Aspose.Words’ Jar with full permission.

Could you please share complete detail of your working environment in which you are using Aspose.Words? We will then provide you more information about your query.

Have you tried the latest version of Aspose.Words for Java 19.11? Please try it and let us know how it goes on your side.