If you’re working with an InfoPath form and are trying to display it as a web enabled form but are getting errors saying the form template failed to load, it may just be due to the manifest for the XSN not containing the relative URL base.
For the following ULS errors:
The form template failed to load. (User: …., Type: NullReferenceException, Exception Message: Object reference not set to an instance of an object.)
Unhandled exception when rendering form System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Office.InfoPath.Server.SolutionLifetime.DataAdapterListDataProvider.
UrlIsSameFileOrSamePath(String absoluteFileUrl, String baseFileOrFolderUrl)….
These are due to the XSN not having the base URL defined, which can be resolved by updating the manifest.xml with the following element:
<xsf3:baseUrl relativeUrlBase="http://qsxdevspstuart2/qcs/Workflows/Problem Evaluation/Problem Evaluation.xsn"/>
The baseUrl element can be found within //xsf:extensions[@name=”SolutionDefinitionExtensions”]/xsf:extension/xsf3:solutionDefinition.
I was using a form deployed to the Form Templates gallery in the Central Administration site but to a different form library. Instead of deploying to FormServerTemplates (Form Templates) I was publishing via code to a custom library. The above problem arose after trying to update the template. The first version deployed worked perfectly but updates to the form were causing the errors shown at the start of this post. Updating the template.xml file (contained within the xsn file) resolved the errors.