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

Free Support Forum - aspose.com

Use Aspose.PDF for Java in Ubuntu 20.04 - setLicense does not work under certain circumstances

I have a simple jar that uses Aspose.PDF to extract text from PDFs. It works when run from the command line but it appears to get hung on setLicense when called via pyjnius. This works all works just fine on Ubuntu 18.04, however on 20.04, the only way to run the jar without getting hung up at setLicense is to run from the command line. It’s strange, and I can’t explain it.

public License SetLicense() throws Exception {
    Logger logger = GetLogger();
    logger.info("SetLicense Initialized");
    License license = new License();
    logger.info("Setting License");
    logger.info(System.getProperty("user.name"));
    try {
        InputStream inputStream = getClass().getResourceAsStream("/Aspose.Pdf.lic");
        if (inputStream.toString() == null) {
            logger.info("Input stream is NULL!");
        } else {
            logger.info(inputStream.toString());
        }
        license.setLicense(inputStream);
        inputStream.close();
    } catch (Exception e) {
        logger.info(e.getMessage());
    }
    return license;
}

When run via java -jar /path/to/jar this completes and all of the logging output can be seen, but when run via pyjnius the last item to appear in the log is this logger.info(System.getProperty("user.name")); part. Again, this works on Ubuntu 18.04, but not 20.04.

Thank you for your assistance.

@chamiltonccn

It seems like you are executing Aspose.PDF for Java classes using Python. Would you please share the version of Python you are using. The only support Python version is Python 2.7.x.x.

I’m using Python version 3.8 with pyjnius. It works if I run it directly via the python (3.8) interpreter; license.setLicense doesn’t hang. But if I run my python program via pipenv it hangs. This only happens on Ubuntu 20.04. On Ubuntu 18.04 it all works flawlessly. I’ve spent two days on this issue alone. Any help you can provide would be most appreciated.

EDIT: To be clear: there is no stack trace / exception / etc. It just sits there. It seems like it’s blocking/waiting for some reason. Forever. Again, it only happens on Ubuntu 20.04. Unfortunately, deploying to an 18.04 server is not an option for us.

Is there any sort of debug logging that can be enabled for this? It would be nice to have some way of knowing where exactly it’s getting hung up. I’ve tried using JPype too but the results are exactly the same.

@chamiltonccn

We need to investigate the scenario in our environment in order to determine the actual cause of the issue. An investigation ticket as PDFJAVA-39668 has been logged in our issue tracking system for the purpose. We will further look into its details and keep you informed with the status of ticket resolution. Please be patient and spare us some time.

We are sorry for the inconvenience.