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

Free Support Forum - aspose.com

Problem with using tomcat when converting PDF multiple times

@alexey.maslov
We could able to start the tomcat server by adding the below line in context.xml(Location: tomcat/conf/)
<Context antiResourceLocking="true"

But after adding this line we checked the concurrent preview conversion(10 MB - 100 pages etc) but the following error still occurs,

04:25:14.884 SEVERE [main] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [application] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@75b431e6]) and a value of type [io.grpc.netty.shaded.io.netty.util.internal.InternalThreadLocalMap] (value [io.grpc.netty.shaded.io.netty.util.internal.InternalThreadLocalMap@204d3d52]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
04:25:14.884 SEVERE [main] org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks The web application [application] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@15fed6a7]) and
a value of type [com.aspose.pdf.internal.l59y.l1v] (value [com.aspose.pdf.internal.l59y.l1v@4111feff]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

Once this error occurs, tomcat server is restarted
Issue Occurance Environment Details:
Java : 1.8
Apache Tomcat : 9.0.54
OS : Redhat linux(rhel-7)

could you verify it once from you side and let us know.

@dev.raz

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input PDF document.
  • Please attach the WAR file to reproduce the same issue at our end.
  • Please share sample Java application (source code without compilation errors).

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

@tahir.manzoor

Access the below url for PDF conversion after deploying the WAR,
localhost:8080/asposetest/preview?file_name=DOCX_100_Pages.docx

Kindly verify the above and let us know.

@dev.raz

Your query is related to Aspose.Words, Aspose.Cells and Aspose.Slides. Regarding Aspose.Words, you will get an answer in Aspose.Words’ forum.

Regarding other products, we are moving this forum thread to Aspose.Total forum where you will be guided appropriately.

@tahir.manzoor
Thank you for the reply
Regarding first point we will check the update in Aspose.Word’s forum ticket.

Regarding other products, we are moving this forum thread to Aspose.Total forum where you will be guided appropriately.

Could you share the link for the forum to check the updates.

@dev.raz,

Regarding Aspose.Cells, I evaluated your samples but I could not find MS Excel files (you provided MS Word and Powerpoint documents in the archive). Do you also reproduce the issue regarding Aspose.Cells API? Could you please provide a separate sample Java project with template Excel files to reproduce the issue regarding Aspose.Cells API, we will check it soon.

@Amjad_Sahi
Thank you for the reply.

Do you also reproduce the issue regarding Aspose.Cells API?
Yes

Excel files
https://github.com/AsposeTest/sample/tree/master/src/main/resources/sample-files

Could you please provide a separate sample Java project
https://github.com/AsposeTest/sample/tree/main/src/main/java/com/asposetest/sample
(https://github.com/AsposeTest/sample/blob/main/src/main/java/com/asposetest/sample/service/AsposeTestServiceImpl.java#L181)
Update WAR :https://drive.google.com/file/d/1wlzXxqq0wjpX9HVWadite3Y8LoZ1dMan/view?usp=sharing

Could you verify the above and let us know

@dev.raz,

Thanks for the template Excel files, samples and War file.

We have logged a ticket with an id “CELLSJAVA-44509” for your issue. We need to investigate your issue in details. We will look into it to figure it out soon.

Once we have an update on it, we will let you know.

@Amjad_Sahi
Could you share the status of this issue?

@dev.raz,

Your issue is not sorted out yet. We will provide details and update you on it soon.

@dev.raz

For the high CPU utilization issue:

Similar solution like this to add time interval:

public void WorkbookToPdfMultithreading() throws Exception
{
    for(int i = 0; i < 5; i++)
    {
        Thread.sleep(3000); // insert timeout here
        MultiThreadRun runner = new MultiThreadRun(mFilePathInMain, mFilePathOutMain);
        runner.start();
    }
}

private class MultiThreadRun extends Thread
{
    MultiThreadRun(String filePathIn, String filePathOut)
    {
        mFilePathIn = filePathIn;
        mFilePathOut = filePathOut;
    }

    public void run()
    {
        try
        {
            Workbook wb = new Workbook(mFilePathIn);
            wb.save(mFilePathOut + getName() + ".pdf");
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    private String mFilePathIn;
    private String mFilePathOut;
}

Aspose.Cells also supports memory preference model in LoadOptions.MemorySetting, please check the document for details.

For the issue:

It is related to Aspose.Pdf