Error when parse license file

Im getting this error on my Tomcat-server. This makes the code not working and I have to restart the server to fix it.
What is wrong? The license-file is placed below WEB-INF catalog.

com.aspose.diagram.DiagramException: Error when parse license file.
at com.aspose.diagram.License.setLicense(Unknown Source)
at com.inputdata.inputprocess.docu.DocCardAction.execute(DocCardAction.java:89)
at sun.reflect.GeneratedMethodAccessor4463.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

@ron.inputdata.no

Thank you for contacting support.

Would you please share a narrowed down sample application reproducing this issue so that we may try to reproduce and investigate it in our environment. Please also share your license file with us via Private Message. Click on my user name and select message icon. Moreover, you may try to specify complete path to your license file as under:

license.setLicense("D:\\Files\\Test\\Aspose.Diagram.Java.lic");

@ron.inputdata.no

Thank you for sharing the license file.

We have tested to set the license using Aspose.Diagram for Java 18.11 but the issue can not be reproduced in our environment. Kindly share a sample application with us along with your environment details (OS dtails, JDK/JRE details) so that we may investigate further to help you out.

The solution I got to work was to create a startupservlet and set the license there. Now its no problems with the license.

@ron.inputdata.no

Thank you for getting back to us.

Mentioned solution will certainly help other community members as well. Please feel free to contact us if you need any further assistance.