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

Free Support Forum - aspose.com

System.NullReferenceException when calling SetLicense()

We just upgraded our application. The PDF watermarking functionality didn't change at all. Moreover, the application is deployed on two servers (behind the load balancer), and one of the servers handles requests without any problems, but the other gives the following error:

System.NullReferenceException: Object reference not set to an instance of an object.
at x22bcffa34b42a390.x220f433da4115056.x7d0214bf69711dd9(Stream xcf18e5243f8d5fd3)
at x22bcffa34b42a390.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4)
at Aspose.Pdf.Kit.License.SetLicense(String licenseName)
at
The license file, Aspose.Pdf.Kit.dll, and Aspose.Pdf.Kit.xml are all the same on both servers; we copied 
these files from the "good" server to the "bad" one, just in case some files got corrupted.
Also, everything works fine in dev and test environments...
Any help or additional troubleshooting options would be greatly appreciated!
Thanks

Hi Felix,

Thank you very much for considering Aspose.

Can you please elaborate a little bit or point me to the issue related to the ‘watermark functionality’?

Moreover, regarding license issue, we’re looking into the issue at our end and you’ll be updated with the results the earliest possible.

We’re sorry for the inconvenience.
Regards,

By “watermark functionality” I meant the functionality that uses Aspose libraries didn’t change. Sorry for confusion.

It looks like after we rebooted the server, the problem went away. I don’t know if aspose.dll got locked or corrupted, or something else - but we don’t have a problem at this time…

Thanks
Felix

Hi Felix,

We’re glad to know that your issue is resolved. If you still find any issue or have some more questions, please do let us know.

Regards,

I’m having a problem with the method setlicense().
From a BizTalk process I call a static method of a library to perform conversion of documents into pdf. <SPAN title="" te="In the static method is where does the license in September.

" se=“En dicho método estático es donde se hace el set license.” closure_uid_f2j9ad=“69”>In this static method is where we call the setlicense() method.

<SPAN title="" te="Navigating the forum I have seen that in a thread there is a possible solution to this issue, but looks more like a workarround a valid solution.

" se=“Navegando en el foro he visto que en un thread se da una posible solución a esta incidencia, pero parece más un workarround que una solución válida.” closure_uid_f2j9ad=“70”>Navigating the forum I have seen that in a thread there is a possible solution to this issue, but looks more like a workarround than a valid solution (http://www.aspose.com/community/forums/203661/object-reference-not-set-error-when-setting-the-license/showthread.aspx#203661)

This is the error call stack that is being generated:

<SPAN title="" te="Navigating the forum I have seen that in a thread there is a possible solution to this issue, but looks more like a workarround a valid solution.

" se=“Navegando en el foro he visto que en un thread se da una posible solución a esta incidencia, pero parece más un workarround que una solución válida.” closure_uid_f2j9ad=“70”>

System.NullReferenceException: Object reference not set to an instance of an object.
at x21e4a7ad326d8315.x220f433da4115056.x7d0214bf69711dd9(Stream xcf18e5243f8d5fd3)
at x21e4a7ad326d8315.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4)
at Aspose.Pdf.License.SetLicense(String licenseName)
at SCO.Sistemas.BizTalk.IndexadorGD.Helpers.Utils.CrearPdf(MemoryStream inStream)
at SCO.Sistemas.BizTalk.IndexadorGD.Helpers.Utils.ConcatenarStreams(XmlDocument mail)
at SCO.Sistemas.BizTalk.IndexadorGD.Helpers.Utils.GetContenido(XmlDocument mail)
at SCO.Sistemas.BizTalk.IndexadorGD.Artefactos.ProcesoIndexar.segment3(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Do you know what may be causing the error?
Thanks in advance,
Guillermo Tato

Hi Guillermo,

Could you please share that how often you’re calling the SetLicense method? Does this error occur every time you try to set the license or some times? If it occurs every time, can you please make sure that the path to the license file is correct and the SetLicense method is able to access it? If it happens some times then could you please try to limit the number of calls to this method? You could call it only once per application; you do not need to call it every time you have to process the files.

Please try it at your end and share your thoughts. We’re sorry for the inconvenience.
Regards,

Hi Shazad ,

first of all, thanks for your quickly reply.

As you advised us we have corrected the number of calls made to the method SetLicense, from two calls to one call. The problem is that there is a process that runs every five minutes. Depending on the pending requests, we run the process of document conversion to PDF. Each request has at least two conversions to make, which involves calling at least twice a conversion method that contains the SetLicense.
Anyway, making the corrections discussed at the beginning of the post, <SPAN title="" se=“De esta forma, hemos podido comprobar que de momento no se ha reproducido el problema.” te="Thus, we have seen that so far has not reproduced the problem.

" closure_uid_57e8js=“1557”>we have seen that so far the problem has not been reproduced.

Still, this does not stop being a workarround, we still want to be able to call the method SetLicense as many times as needed without having to worry about an unexpected error. <SPAN title="" se=“Hay alguna solución posible a este problema?” te="Is there any possible solution to this problem?

" closure_uid_57e8js=“1559”>Is there any possible solution to this problem?

Thanks and regards,

Guillermo

Hi Guillermo,

Can you please share a small sample application which can help us reproduce the same issue at our end? This will help our team to understand and then resolve the issue.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,