WildFly application gives documents4j LocalConverter: ConversionInputException after a while

47 Views Asked by At

I have a Spring-based application running on WildFly as a Windows service. One of the APIs in my application utilizes documents4j LocalConverter to convert Word documents to PDF files. The conversion works perfectly when I start the WildFly service, but after a while, I encounter the following

error: "com.documents4j.throwables.ConversionInputException: The input file seems to be corrupt." 

This error occurs for all conversion requests, even though I am confident that the input files are not corrupted, as they have been successfully converted before the error occurs.

Restarting the WildFly service temporarily resolves the issue, but the problem resurfaces after some time.

I'm using a singleton instance of IConverter that I initialize using the following code:

converter = LocalConverter.builder()
                    .workerPool(20, 150, 2, TimeUnit.SECONDS)
                    .processTimeout(10, TimeUnit.SECONDS)
                    .build();

This instance is initialize only once and used for any conversion request using this code:

converter
    .convert(in).as(DocumentType.MS_WORD)
    .to(bo).as(DocumentType.PDF)
    .prioritizeWith(1000)
    .execute();

What am I missing here ? Also is the way I'm initializing and using the LocalConverter correct ?

0

There are 0 best solutions below