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

Free Support Forum - aspose.com

Aspose.PDF for java thread lock

we are using aspose PDF for java to create thumbnail from PDF:

Document file = new Document(fileContent);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
JpegDevice jpegDevice = new JpegDevice(100);
jpegDevice.process(file.getPages().get_Item(1), outputStream);

Sometimes it happens that our thread stuck and in thread dump we could find

  • com.aspose.pdf.internal.ms.System.Collections.Generic.Il.containsKey(java.lang.Object) @bci=95 (Compiled frame; information may be imprecise)
  • com.aspose.pdf.internal.l74.I0l.lI(java.lang.String) @bci=11 (Interpreted frame)
  • com.aspose.pdf.internal.l74.I0l.lif(java.lang.String, com.aspose.pdf.internal.ms.System.Collections.Generic.I27, com.aspose.pdf.internal.ms.System.Collections.Generic.I27, com.aspose.pdf.internal.l247.II) @bci=2 (Interpreted frame)
  • com.aspose.pdf.internal.l74.I0l.lif(com.aspose.pdf.internal.l15l.I27, com.aspose.pdf.internal.l15l.I37, boolean, boolean) @bci=673 (Compiled frame)
  • com.aspose.pdf.internal.l74.I0l.lif(com.aspose.pdf.internal.l3I.I01, com.aspose.pdf.internal.l4I.I11, com.aspose.pdf.internal.l26l.I1l, com.aspose.pdf.internal.l7l.I07[]) @bci=19 (Interpreted frame)
  • com.aspose.pdf.devices.I7.lif(com.aspose.pdf.internal.l7l.I07[]) @bci=846 (Interpreted frame)
  • com.aspose.pdf.devices.I7.lif() @bci=13 (Interpreted frame)
  • com.aspose.pdf.devices.ImageDevice.lif(com.aspose.pdf.Page) @bci=147 (Interpreted frame)
  • com.aspose.pdf.devices.JpegDevice.processInternal(com.aspose.pdf.Page, com.aspose.pdf.internal.ms.System.IO.Stream) @bci=2 (Interpreted frame)
  • com.aspose.pdf.devices.JpegDevice.process(com.aspose.pdf.Page, java.io.OutputStream) @bci=11 (Interpreted frame)


Thanks for contacting support.

Would you please share sample PDF document with which you are facing this issue in your environment. Also, please share your environment details like JDK Version, Application Type etc. Please make sure to test the scenario using latest version of the API before sharing requested details. We will test the scenario in our environment and address it accordingly.

Thanks for reply. I have tried to use latest version of api, but I’ve encountered obstacles. When I switch to aspose pdf 18.9 or higher I get:

java.lang.ExceptionInInitializerError: null
at com.aspose.pdf.ADocument.lf(Unknown Source) ~[aspose-pdf-18.11.jar!/:na]
at com.aspose.pdf.l6v.lI(Unknown Source) ~[aspose-pdf-18.11.jar!/:na]
at com.aspose.pdf.l6v.lI(Unknown Source) ~[aspose-pdf-18.11.jar!/:na]
at com.aspose.pdf.ADocument.lI(Unknown Source) ~[aspose-pdf-18.11.jar!/:na]
at com.aspose.pdf.ADocument.<init>(Unknown Source) ~[aspose-pdf-18.11.jar!/:na]
at com.aspose.pdf.Document.<init>(Unknown Source) ~[aspose-pdf-18.11.jar!/:na]


 EmlLoadOptions options = new EmlLoadOptions();
 MailMessage email = MailMessage.load(inputStream, options);
 ByteArrayOutputStream htmlOutputStream = getOutputStreamWithHeader(email);
 HtmlSaveOptions defaultHtml = SaveOptions.getDefaultHtml();
 email.save(htmlOutputStream, defaultHtml);
 ByteArrayInputStream htmlInputStream = new ByteArrayInputStream(htmlOutputStream.toByteArray());
 HtmlLoadOptions htmloptions = new HtmlLoadOptions();
 Document doc = new Document(htmlInputStream, htmloptions);

java build 1.8.0_181-b13
os RedHat 7.4
I don’t know if that matters but I use a few aspose libraries:
aspose-words 18.12
aspose-slides 18.11
aspose-cells 18.11
aspose-email 18.9


Thanks for sharing further details.

Would you kindly share the sample files with which you are trying shared code snippet. It would help us testing the scenario in our environment and address it accordingly.

Hi thanks for reply. I have maven project which reproduces this issue, but I’d prefer not to put it here. Is there possibility to email you that? Could you give me an email?


Thanks for sharing the sample project in private message.

We are testing the scenario in our environment and will share our feedback with you shortly.


Thanks for your patience.

We have tested the scenario in our environment and as per our findings, the exception you shared looked related to specific environment. We have tested the scenario on two different machines running IntelliJ IDEA Community 2018.3 and were able to notice the exception only in one. Only difference between the environment was Maven Repository Cache Path.

Could you please share complete stack trace which has been observed at your side with exception. We will further proceed our investigation and share our feedback accordingly. Furthermore, please also find the generated PDF document in our environment which was obtained in success case of testing the scenario.

test.pdf (109.2 KB)

Thanks for reply. I execute application from command line. I get following stacktrace:

Exception in thread “main” java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.ExceptionInInitializerError
at com.aspose.pdf.ADocument.lf(Unknown Source)
at com.aspose.pdf.l6v.lI(Unknown Source)
at com.aspose.pdf.l6v.lI(Unknown Source)
at com.aspose.pdf.ADocument.lI(Unknown Source)
at com.aspose.pdf.ADocument.(Unknown Source)
at com.aspose.pdf.Document.(Unknown Source)
at batch.preview.creator.MsgPreviewCreator.generatePdfPreview(MsgPreviewCreator.java:60)
at batch.preview.creator.MsgPreviewCreator.generatePdfPreview(MsgPreviewCreator.java:23)
at batch.preview.creator.PreviewCreator.createPreview(PreviewCreator.java:30)
at batch.preview.manager.PreviewManager.createPreview(PreviewManager.java:46)
at batch.preview.manager.PreviewManager.createAndSavePreview(PreviewManager.java:31)
at batch.Filerepo2BatchApplication.main(Filerepo2BatchApplication.java:18)
… 8 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unsupported classes source type.
at com.aspose.pdf.internal.l9y.lf.(Unknown Source)
… 20 more
Caused by: java.lang.RuntimeException: Unsupported classes source type.
… 21 more


Thanks for providing details.

We have logged an investigation ticket as PDFJAVA-38255 in our issue tracking system. We have also recorded all test results and information provided by you along with the ticket. We will further look into details of the logged ticket and keep you posted with the status of its resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFJAVA-38255) have been fixed in Aspose.PDF for Java 19.2.