Free Support Forum - aspose.com

Object Reference Not Set Error When Setting the License

We are getting the error below when converting PDFs to TIFFs. The error does not happen every time a conversion takes place and, if the same PDF is sent again, it converts without a problem. We are running on a 2 server balance-loaded farm. The license file exists in the web service's bin folder.

Lines 42 and 43 referenced in the stack trace are:

License license = new License();
license.SetLicense("Aspose.Pdf.Kit.lic");

The trapped error is:

Error occurred during PDF to TIFF conversion process. <br />ERROR: Object reference not set to an instance of an object. <br/>STACKTRACE: at x22bcffa34b42a390.x220f433da4115056.x7d0214bf69711dd9(Stream xcf18e5243f8d5fd3)

at x22bcffa34b42a390.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4)

at Aspose.Pdf.Kit.License.SetLicense(String licenseName)

at Lyo.SharedServices.Document.Conversion.BLL.LyoPdfConversionBLL.ConvertToTiff(String transmissionKey, String workingDirectory, String inputPdfFileList, String outputTiffFileName) in D:\dev\Projects\LyoSharedServices\2008.Q1\App\Components\3.5\Lyo.SharedServices.Document.Conversion.BLL\LyoPdfConversionBLL.cs:line 43

at Lyo.SharedServices.DocumentConversion.Wrk.LyoDocumentConversionWrk.aConvertPdfToTiff_ExecuteCode(Object sender, EventArgs e) in D:\Dev\Projects\LyoSharedServices\2008.Q1\App\WWF\3.5\Lyo.SharedServices.DocumentConversion.Wrk\LyoDocumentConversionWrk.cs:line 42

Any help will be greately appreciated.

Michael Bianchi

Hi Michael,

Thank you very much for considering Aspose.

Please share a sample project (a complete web service) which can reproduce the problem. We need to test the issue at our end. Please also send the license file following the instruction at this link. Moreover, please share machine specification, OS details, .NET version, Aspose.Pdf.Kit version etc.

We’ll investigate the issue at our end and update you accordingly.

We’re sorry for the inconvenience.
Regards,

Hi Michael,

I have tested the issue at my end but couldn’t reproduce the problem. Can you please share one of the problematic PDFs? We’ll test the issue with the problematic PDF and update you accordingly.

We’re sorry for the inconvenience.
Regards,

I will have to check to see if company policy allows for sharing of these documents. However, the same document, when resubmitted, will process without a problem. Where you able to test in bursts of 100 or 200 PDFs being sent within milliseconds of each other?

Thanks!

Michael

Hi Michael,

I would like to share that it doesn’t make any difference with Aspose.Pdf.Kit if you process single document or a large number of documents in a batch. In fact, sometimes problem is caused due to the particular contents or origin of the PDF file. We’ll have to look into the issue using particular problematic PDF.

Regarding sharing the documents, I would like to inform you that you can either mark the post as private or send via email using ‘Contact -> Send Email’ option from the forum menu. The files shared by the customers are used for testing purposes and are accessible by the Aspose staff only.

We’re looking forward to help you out.
Regards,

It seems the issue cannot be replicated outside our production environment. I have been directed to find an alternate path to interface our SAP system to the converter service. On that note, I would like to know if your component has a command-line interface. If so, where can I find the documentation for it?

Thanks!

Michael

Hi Michael,

We’re getting this type of requirement for the first time, so we’ll have to test it at our end. Please spare us some time for further investigation. We’ll update you with the results, the earliest possible.

We’re sorry for the inconvenience.
Regards,

We've been working on trying to resolve this issue for several months now to no avail. Has there been any progress by your developers in fixing this issue? If possible, I would like to speak to one of the developers directly.

As an example of the severity of the issue, this morning we processed 600 PDFs of which 390 failed with the "Object reference not set to an instance of an object" error when the application calls the SetLicense method. This past Monday, we processed over 1000 PDFs and less than 1% were successful. However, on subsequent runs during the day, the same PDFs are converted successfully.

The license file is in the \bin directory of the application along with the Aspose.pdf.kit.dll, and .res files.

It is critical that we resolve this issue as it is hindering our ability to pay our vendors in a timely manner. My management is already asking me to look at alternate products as well.

Thanks!

Michael

Hi Michael,

We’re very sorry for the inconvenience.

As I had already shared with you that I was unable to reproduce the problem at my end and it is very important for our development team to reproduce the issue in order to resolve it. I tested the issue with the complete scenario and code you shared earlier.

However, I have contacted our development team for their opinion on this issue. You’ll be updated shortly.

Moreover, can you please try the latest version at your end to see if it resolves your issue?

We appreciate your patience.
Regards,

Hi Michael,

I would like to add something more to my previous post. In the meanwhile, we try to find out the cause of this issue and provide you a fix, can you please try the following workaround at your end?

1. Limit the number of calls to SetLicense method - try to call it on per-application basis, not for every document (as you are working with Web Application/Web Services, you can call it in Application_Start or Session_Start).

2. Try to change the licensing code as shown below:


int nAttempts = 5;

do

{

try

{

Aspose.Pdf.Kit.License license = new Aspose.Pdf.Kit.License();

license.SetLicense("Aspose.Pdf.Kit.lic");

break;

}catch

{

System.Threading.Thread.Sleep(100);

}

}while (nAttempts-->0);


Please try above workaround and share whether it works in your scenario or not.

We’re looking forward to help you out.
Regards,