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

Free Support Forum - aspose.com

Error when placing 2 aspose jar in the same directory

Hi,


I have a problem that happens when I put both Aspose.Words for Java and Aspose.Pdf for Java in the same directory.

If I then try to use our servlet to fill a report template, I get the following exception:

java.lang.ExceptionInInitializerError com.aspose.words.ac.(Unknown Source) com.aspose.words.xq.(Unknown Source) com.aspose.words.gx.(Unknown Source) com.aspose.words.gx.(Unknown Source) com.aspose.words.lt.(Unknown Source) com.aspose.words.jasperreports.a.c.(Unknown Source) com.aspose.words.jasperreports.AWAbstractExporter.exportReport(Unknown Source) com.agews.suite626.servlet.old.ReportSGS.exportReportToBytes(ReportSGS.java:341) com.agews.suite626.servlet.old.ReportSGS.compileReport(ReportSGS.java:668) com.agews.suite626.servlet.old.ReportSGS.processRequest(ReportSGS.java:196) com.agews.suite626.servlet.old.ReportSGS.doPost(ReportSGS.java:307) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

Root cause:

java.lang.SecurityException: class “a.b”'s signer information does not match signer information of other classes in the same package java.lang.ClassLoader.checkCerts(Unknown Source) java.lang.ClassLoader.preDefineClass(Unknown Source) java.lang.ClassLoader.defineClass(Unknown Source) java.security.SecureClassLoader.defineClass(Unknown Source) org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2895) org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) com.aspose.words.xn.(Unknown Source) com.aspose.words.ac.(Unknown Source) com.aspose.words.xq.(Unknown Source) com.aspose.words.gx.(Unknown Source) com.aspose.words.gx.(Unknown Source) com.aspose.words.lt.(Unknown Source) com.aspose.words.jasperreports.a.c.(Unknown Source) com.aspose.words.jasperreports.AWAbstractExporter.exportReport(Unknown Source) com.agews.suite626.servlet.old.ReportSGS.exportReportToBytes(ReportSGS.java:341) com.agews.suite626.servlet.old.ReportSGS.compileReport(ReportSGS.java:668) com.agews.suite626.servlet.old.ReportSGS.processRequest(ReportSGS.java:196) com.agews.suite626.servlet.old.ReportSGS.doPost(ReportSGS.java:307) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

If I move one of the jar in another directory, both on the classpath, it all works fine.

How can I overcome this problem? I’d like all my jars to be in the same folder.
Hi Matteo,

Thanks for your inquiry. Form the error description, It seems that you are using Aspose.Words for JasperReports. In case you are using an older version of Aspose.Words for JasperReports, I would suggest you please upgrade to the latest version (v1.8.0) from here and let us know how it goes on your side.

Could you please share which version of Aspose.Pdf for JasperReports you are using? I suggest you please use the latest version of Aspose.Pdf for JasperReports 1.2.0.

If the problem still remains, please attach a sample jrxml file along with code here for testing. I will investigate the issue on my side and provide you more information.

Here is the libraries I am using:


- Aspose.Words for Java v13.4
- Aspose.Words for JasperReports v1.8
- Aspose.Pdf for Java v4.0

As you see, I do NOT use Aspose.Pdf for JasperReports
Hi Matteo,

Thanks for sharing the detail. It would be great if you please share the detail what exact you want to achieve by using Aspose.Words. Could you please share the code which throws the shared exception?

Little background: our web application uses Aspose fo Java classes through some Java Servlets running on Tomcat 7, which take the post parameters to fill in the specified document template.


The iter is the following:
- receive data of the document to be filled
- load all needed .jrxml and compile them
- transform the document as an instance of com.aspose.words.Document
- save it in the requested format (which can be any one of .doc, .docx, .odt or .pdf)

The servlets use some libreries, which I would want to be stored all in the WEB-INF/lib folder, however, if I do so, I get the exception reported in the first post, which gets solved if I move the aspose.pdf.jar file in the main tomcat /lib directory.

The offending code seems to be the following:

protected byte[] export(JasperPrint jasperPrint, JRExporter exporter) throws JRException {
byte[] output2;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
exporter.exportReport();
output2 = baos.toByteArray();

return output2;
}

More specifically, all starts from the call to exportReport().

Please note that JRExporter exporter is always an instance of AWDocExporter in this case.

Now, I could just leave the Aspose.Pdf library in the main tomcat library directory, but I would want to avoid doing so, if there is a way to solve this problem.
Hi Matteo,

Thanks for sharing the detail. I have tested the scenario with a simple Java application and have not found the shared issue. I have included the following jars files in my Java application.

  • Aspose.Words for Java v13.4
  • Aspose.Words for JasperReports v1.8
  • Aspose.Pdf for Java v4.0

I have tested the issue with jasperreports-4.5.1 version. Please share following details for further investigations.

What environment are you running on?
  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • Java version
  • Please share the Jasper Report version
  • If you are facing this issue with a specific jrxml file, please share that jrxml file along with data source as CSV or XML.
  • Please also share any necessary steps which you need me to follow to reproduce this issue.
  • You are exporting your jrxml file into .Doc/Docx/ODT and Pdf. Are you using any Aspose.Pdf code in your web application? If yes, please share the detail what you want to do by using Aspose.Pdf.

I will prepare the required platform to simulate the environment ( with Tomcat 7) as of yours and test this issue. Thanks for your patience and understanding.

tahir.manzoor:
What environment are you running on?
  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • Java version
  • Please share the Jasper Report version
  • If you are facing this issue with a specific jrxml file, please share that jrxml file along with data source as CSV or XML.
  • Please also share any necessary steps which you need me to follow to reproduce this issue.
  • You are exporting your jrxml file into .Doc/Docx/ODT and Pdf. Are you using any Aspose.Pdf code in your web application? If yes, please share the detail what you want to do by using Aspose.Pdf.

I will prepare the required platform to simulate the environment ( with Tomcat 7) as of yours and test this issue. Thanks for your patience and understanding.

Windows 8 PRO 64 bit
JDK 7 32 bit
JasperReports 5.1
Tomcat 7 32 bit

I shared all .jrxml templates with csv data and .jrprint in my previous posts.

I am currently using Aspose.Pdf for Java in only ONE specific report (not the ones with the problem) to place signature fields in the document.
Hi Matteo,

Thanks for your patience.

I have managed to reproduce the same issue at my side. I have logged this issue as WORDSJSP-109 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.