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

Free Support Forum - aspose.com

Difficulty correctly configuring metered license

I’ve recently purchased a metered subscription but am having difficulty setting it up. A few questions in no particular order:

  • The documentation says “you should regularly check the license status”, but I don’t see a way to do this. The only relevant API, License.isLicensed(), seems to have been removed.
  • Does Aspose provide any way to configure logging? Does it log anything about its attempts to phone home? I didn’t see any log output, but my metered license instance switched into evaluation mode without warning.
  • Is there a way to force Aspose to phone home and switch to evaluation mode if it fails? I’d like to check that my configuration is working on my dev machine, but I can’t wait 24 hours to see if it happens to switch to evaluation mode.
  • What hostnames/IPs and ports does Aspose try to talk to?
  • The documentation suggests that I have to use a public/private key and not a file, but if I view my order on aspose.com, it offers to let me download a license file. Is there a difference? If I were to use the file for this metered subscription, I assume I use the License class instead of Metered?
  • How does the payment period relate to evaluation mode? Specifically, is there a grace period? It seems I pay the monthly fee ahead of time, but if that’s late for whatever reason does it immediately switch into evaluation mode?

Aspose.Words 22.3 for Java


Yes, License.isLicensed() has been removed from the public API due to the security reasons. You can use the following simple code to check whether the license is set or not. It assumes that Aspose.Words injects evaluation message into the document when work in evaluation mode:

private static boolean isLicensed() throws Exception
    String testString = "test";

    Document doc = new Document();
    DocumentBuilder builder = new DocumentBuilder(doc);

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    doc.save(outputStream, SaveFormat.DOCX);

    ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
    doc = new Document(inputStream);

    String test = doc.toString(SaveFormat.TEXT).trim();
    return test.equals(testString);

Unfortunately, there is no way to enable logging in Aspose.Words or in Metered Licensing mechanism.

You can call License.setLicense method with an empty string as a parameter to switch Aspose.Words in evaluation mode:

License lic = new License();

// This will print 'true'


// This will print 'false'

It talks to https://purchase-api.dynabic.com/v1.2

If you have a license file, this is another licensing mechanist that does not require interaction with the server. You can simply set license once per application domain using code like the following:

License lic = new License();

See our documentation for more information.

I have forwarded this question to out sales department. They are in the better position to answer it.

Thank you for the detailed reply!

I see this checks whether a license has been set, but not whether the license is valid. (I checked before/after when passing nonsense values for a metered key.) Among other things, I’m trying to debug whether the public/private keys are making it through to the licensing server unmangled. Is there a way to check that the license is valid, and not merely set?

To clarify, my request here was related to my response immediately above this quote: I want to see if the licensing server is accepting my license. I was hoping for a way to force the library to validate the license on demand so I could confirm without having to wait 24 hours to revert to evaluation mode in the case of failure.

The license file I downloaded from the order page is an XML file with a public/private key pair and nothing else in it. It’s very different structurally from the license file I had previously (which was not a metered license). It would be easier for me to use this file than pushing the public/private key pair around, which is why I asked about its validity. I’m unable to easily confirm whether it works on my own due to the aforementioned issues around confirming license validity with the licensing server.

Thanks for doing that. I wasn’t aware I could contact the sales department through this forum too; I’ll do that in the future.


Unfortunately, there is no other way to check validity of the license except setting it. If the license is invalid Aspose.Words will throw an exception.

You can read the values of the public/private key pair directly from XML file to make sure the values are not damaged.

I see, and thank you for your replies. One follow-up:

I think we’re talking past each other. I replaced my private key with the literal string garbage, and the library happily served up non-watermarked documents without any indication that something was wrong with the public or private keys. I assume that after 24 hours it would revert to trial mode – or are you saying that after 24 hours, it should throw an exception?

I’d like to request a feature, in that case: some kind of API call that validates a configured public/private key pair on-demand. Perhaps Metered.isValid()?

I’m assuming there is some misconfiguration on my part that is causing my issues, but without a way to reliably test the public/private key configuration end-to-end, I am reduced to making a guess and then waiting for 24 hours to see if it reverts to trial mode. Unless I am misunderstanding something, and there is a much faster way to test that it’s properly configured and the server is reachable?

Edit: replaced “license” with something clearer, I hope!

@epaulet-society Thank you for additional information. I will consult with the team responsible for the metered licensing mechanist development and get back to you once receive the answer from them.

Thank you. I’ve decided to roll back our licensing changes until you come back to me with a technique I can use to test more quickly.

Can you confirm if you are seeing any calls back to your licensing service with the keys from my account? My latest test was a failure: I was using the library successfully > 24 hours ago without watermarking, but as of ~20 minutes ago, it has again reverted to watermarking.

@epaulet-society I do not have access to licensing service so I cannot check. I still wait for response from the responsible team. Please accept our apologies for your inconvenience.

@epaulet-society I have received the response from the team responsible for metered license mechanism.

Your license works now. You can start to use it again.

No, the Aspose downloadable products don’t expose a method where they can validate the metered license without applying it.

After some time spent testing with different configurations, I can confirm that the license appears to work in all my environments. Thanks for resolving that. I see now that my server will throw an exception if the license is obviously misconfigured, rather than silently work for 24 hours.

I’m concerned that what appears to have been a clerical error out of my control can have this effect. Furthermore, the documentation is unclear on what exactly happens when the license is not in a good state. As far as I was able to find, it doesn’t mention anything about throwing exceptions, only watermarking.

Can you clarify in which scenarios I would expect to see watermarking versus exceptions being thrown? Generally, I would prefer the latter, as a hard failure is quicker to identify and resolve than waiting for users to start asking questions about watermarks.


The metered licensing mechanism throws an exception if credentials are specified improperly. Exception like this is thrown:

System.InvalidOperationException: 'Authentication failed.'

Watermark is added if the license was not applied. This might occur in several cases:

  • code that sets license was not run;
  • the exception thrown by licensing mechanism is catch and silenced;
  • the license was set properly, but then removed by calling License.SetLicense method with an empty string as a parameter.

Also, please, see Metered Licensing FAQ.

Thank you for the clear answer, I’m satisfied. I was aware of the FAQ, but neither it nor the API documentation spelled out the cases as you have.

1 Like