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

Free Support Forum - aspose.com

Code works locally, errors on second pass in production environment

This code works locally run multiple times. In our production environment, it works once and then throws a null pointer exception

at com.aspose.font.FontEnvironment.lif(Unknown Source)
at com.aspose.font.I644.lif(Unknown Source)
at com.aspose.font.Font.open(Unknown Source)
at com.squish.uploader.ConvertFont.(FontInstaller.java:550)

FileSystemStreamSource fsss = new FileSystemStreamSource(fontFile.getPath());
FontDefinition fd = new FontDefinition(FontType.TTF, new FontFileDefinition(“ttf”, fsss));
Font font = Font.open(FontType.TTF, fsss);

I have confirmed that nothing is null.

No form of loading a font works more than one time without restarting the webserver.

All versions of jdk1.8*
Have tried several versions of Java, both native and open, currently running amazon-corretto-8.332.08.1 (the same Java version works correctly locally).


Is it happening with a specific font file or with any font file? Would you please make sure to use the latest version of the API and if the issue still persists, please let us know.

Yes, it’s any font file and yet we are using the most current version of the API 21.12.

Once Font.open(fd) is called in the running webserver instance it returns a NPE for all subsequent calls. I have tested on multiple webservers running multiple versions of Java with the same results.


We are checking it and will get back to you shortly.


An investigation ticket as FONTJAVA-29 has been logged in our issue management system to further analyze this case. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.