Free Support Forum - aspose.com

Aspose Word for Java 20.5 is not compatible with Aspose.Words for Jasper Reports

Hi support,

I am trying to update my Aspose Word Libraries from version 17.6.0 to the newest ones, i.e.

aspose-words-20.5-jdk17.jar (aspose-words-20.5-java)
aspose.words.jasperreports-20.4-7.1.0-7.5.0.jar (Aspose.Words.JasperReports-20.4)

It seems that these libraries are not compatible (interface IExpandableAttr), I get the following error:

java.lang.IllegalAccessError: class com.aspose.words.jasperreports.internal.awjr299 cannot access its superinterface com.aspose.words.IExpandableAttr
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at com.aspose.words.jasperreports.internal.aei.(Unknown Source)
at com.aspose.words.jasperreports.internal.awjr294.(Unknown Source)
at com.aspose.words.jasperreports.internal.awjr58.(Unknown Source)
at com.aspose.words.jasperreports.internal.awjr57.(Unknown Source)
at com.aspose.words.jasperreports.internal.awjr57.(Unknown Source)
at com.aspose.words.jasperreports.internal.awjr59.(Unknown Source)
at com.aspose.words.jasperreports.internal.awjr2869.(Unknown Source)
at com.aspose.words.jasperreports.AWAbstractExporter.exportReport(Unknown Source)

I get the same error by using the previous version aspose-words-20.4-jdk17.jar.
I don’t get the error by using both libraries from version 19.12.

To reproduce the error do these steps:

  1. Add on your classpath these jar files

aspose-words-20.5-jdk17.jar (aspose-words-20.5-java)
aspose.words.jasperreports-20.4-7.1.0-7.5.0.jar (Aspose.Words.JasperReports-20.4)
jasperreports-javaflow-6.12.2.jar or another previous version

  1. copy the attached file “jrprint.jrprint” or some other .jrprint file to “C:\temp\Aspose” .
  2. Create and execute this class (package of your choice)

package test;

import net.sf.jasperreports.engine.;
import net.sf.jasperreports.engine.export.
;
import net.sf.jasperreports.engine.util.;
import com.aspose.words.jasperreports.
;

public class TestAspose {

public static void main(String[] args) {
System.out.println(“TestAspose start”);
try{
AWDocxExporter exporter = new AWDocxExporter();
JasperPrint printFile = (JasperPrint)JRLoader.loadObjectFromFile(“C:\temp\Aspose\jrprint.jrprint”);
String outputDocx = “C:\temp\Aspose\AsposeExport.docx”;

  exporter.setParameter(JRPdfExporterParameter.JASPER_PRINT, printFile);
  exporter.setParameter(JRPdfExporterParameter.OUTPUT_FILE_NAME, outputDocx);
  exporter.exportReport();
}catch(Exception e){
  e.printStackTrace();
}
System.out.println("TestAspose end");

}
}

Many thanks for your help
Dan

jrprint.zip (2.3 KB)

@dan.albutiu

We have tested the scenario using the latest version of Aspose.Words for Java and Aspose.Words for JasperReports. We have not found the shared issue. Please remove all old versions of Aspose.Words’ jar files from your system and make sure that you are using the latest jar files.

In your case, you need to use aspose.words.jasperreports-20.4-6.0.0-6.2.1.jar. We suggest you please read the following article.
Integration with JasperReports

A post was split to a new topic: Aspose Word for Java is not compatible with Aspose.Words for Jasper Reports