Object reference not set to an instance of an object.

  • 26 February 2008
  • 39 replies


I have narrowed this issue down to the level of identifying that it's an InfoPath Publishing Error. Basically, I can raise it from the VS.NET when trying to deploy the K2 Process. I gave the user who encounters this problem an administrative permission on the site collection and still the same. I'm also wondering that it works fine on the Testing Server but in the live server it doesn't "I know the fact that everything works on testing environment where the live one is totally the opposite!".

However, I tested the Runtime Services authentication for that user and it's fine, the user can successfully access the web services. I've also reinstalled K2 Designer in that machine and nothing has been changed. From a different machine, I wasn't able to deploy the process "InfoPath Form" for that user. My username works fine in all levels and that certain user can't even detect if the given name of the MOSS library is correct or not.

Here is the usual error message:

Server was unable to process request. ---> Object reference not set to an instance of an object.

I'm still working on this issue and can't figure our what is missing... If someone has any tips or certain conditions to solve this issue, please let me know.





39 replies

Badge +3
We have the same problem... sometimes. I've noticed two possible conditions: there's a bad Sharepoint path referenced in the Infopath wizard (it can be the address of the publication site, the name of the form lib), or a timeout, which leads your VS to find no such path of lib. However I never found a real solution for this.


Thanks Nicolas for your prompt reply..

Neither of them can be a possible condition for my case. The MOSS path works fine with other users "for instance, my account", I guess this scenario will eliminate both assumptions.

Badge +3
Humm... Really interesting. What if this user tries to deploy from the machine of another user (who doesn't encounter this problem), using "Run As..." command, not to load all their environment?

Still, it's not related to the machine since I can deploy from it. Even though, the user who can deploy the InfoPath form can always do the same thing from all machines. On the other hand, this will also be implied on the user who isn't able to deploy the InfoPath form. I tested the "Run As.." before, and it didn't change anything.

Again, please keep in mind that the user who can't deploy the InfoPath form is able to browse and access the RuntimeServices & K2MOSS webservices "K2SP*.asmx". He is also able to deploy the processes "with no-InfoPath-involved" to the K2Server, Site Collection admin. what else?? I gave him everything, I afraid that it could be a problem of being overpermitted ;)

The weird piece of this puzzle is that I intentionally gave a wrong form library name to the InfoPath Integration Wizard to test whether or not the user can successfully access the K2 MOSS webservice. First and during the process deployment, the user's machine tries to access the MOSS Server "I have traced the traffic" and secondly it returned the same error message. This indicates that the user can't even check the form library existence in the MOSS server. Thirdly, which IMHO is my favorite & enjoyment part, it works fine with this account if I specify that the form client is "InfoPath, Web Browser if InfoPath not available", the "Web Browser" option is the crux.

Thanks for your elaboration and support...



Badge +3

Hi Saleh,

I still don't have the solution to this problem but now I experience exactly the same problem... I use two accounts in my all day work, and by mistake, I opened Visual Studio with the wrong one this afternoon. When trying to deploy, I got the exact same error. I immediately thought about this thread and changed the form opening mode to "InfoPath, Web Browser if InfoPath not available" and it worked.

I feared I was stuck until I noticed I was using my wrong account. Switching to the good one allowed me to deploy successfully.

I tried again with the first account after I gave it the exact same permissions on the server and the site collection, but the error was still there.

Have you opened a support ticket?

Did you check the IIS Logs for the MOSS site and also the K2 web services site?  It should be in C:WindowsSystem32LogFiles<site ID>

Looking at the log entries when you try to do the deployment might help to turn up some clues as to what user identity is being used to connect to the MOSS site and also the K2 web service.


Nope, I haven't. Actually, "InfoPath, Web Browser if InfoPath not available" is what I really need which, in turn, works perfectly. I won't bother for that.


IIS logs don't give much clue. It only reveals the accessed pages and web services "URI Stem", Protocol Status, etc.



Does it show the identity of the user accessing the pages?
Sure it does... All users even the end users who access the RuntimeServices as well as MOSS.

I am now getting this error. Everything was working perfectly and deploying fine but I noticed some logical flaw in the workflow where it was going to the wrong activity. I added a simple line rule, but now when I deploy I get the error "Server was unable to process request. ---> Object reference not set to an instance of an object." The file reference is a .msbuild file with the same name as the .kprx file, line 68.

 I've opened this file and lines 66, 67, 68 are as follows:

 <Target Name="InfoPath Process and Event Deployment" Condition="$(InfoPath_Process_And_Event_Deployment) == 'true'">
    <SourceCode.DeploymentTasks.InfoPath.PublishFormTemplateTask TaskGuid="305ecc7e14b54ca0a68639161c69847c" />

Badge +3

Yeah, I think Saleh and I have the same thing.

We'll definitely have to open a ticket. I'll do that this evening, with a link to this thread.

I've just discovered that in the InforPath Integration wizard, if I test the connection for the web server I get an error:

"Connection failed. The request failed with HTTP status 401: Unauthorized."

 Previously this has tested fine and I've deployed successfully about 30 times. No config has changed since I last deployed successfully.


Edit: I've now tried accessing that URL directly in a browser from the server K2 is installed on, and I get straight into the K2 Workspace. However if I try accessing that URL in a browser from the server I am deploying from, I get a 401.1 error. No idea why this has started happening but this looks like the cause of the problem.

My last post was probably a red herring. I resolved the Kerberos problem using setspn to remove the SPNs for the K2 server from the server I am deploying from. That allowed me to access the web service again but I still get the same error when trying to deploy ("Server was unable to process request. ---> Object reference was not set to an instance of an object.").

 Anyone else got any further with this?

 I raised a support ticket but no word so far.

Another thing I have tried is going back to a backup of my project from a couple of days ago when there was no problems with deployment. That project will not deploy now. Therefore it's not a fault with the project itself.
Badge +3
I opened a ticket too... With a link to this thread. Thus, they can't ignore our problem 🙂

A simple workaround if you have a special requirement to run the InfoPath Form in Web mode only is to force that from MOSS "Library Settings" rather than K2 InfoPath Integration Wizard.

InfoPath Library -> Settings -> Form Library Settings -> Advanced Settings -> Opening
browser-enabled documents
-> Display
as a Web page

In my case, this workaround has solved the problem.




A simple workaround if you have a special requirement to run the InfoPath Form in Web mode only is to force that from MOSS "Library Settings" rather than K2 InfoPath Integration Wizard.

 Unfortunately my project won't deploy with either InfoPath mode! I'm stuck until support get back to me.

Can you use another machine to deploy the project from? Please keep me posted..



Hi Guys,

We've figured out what is causing this. K2 requires that the user deploying the process is a Farm Administrator, so as soon as you add that user to the Farm Administrators group and do an IISReset(needed for central admin changes to take effect) it will successfully deploy. Obviously this is a major security issue and not even an option for some customers to add all the developers to the Farm Administrators group. We have therefore logged this as a Critical bug which will be fixed with an Update as soon as possible.



Badge +3

Hi Gert,

Thanks for the info. I confirm it works when I add my account to the farm administrators list.

Different problem for me then as mine doesn't deploy (I was already a Farm Administrator).

I'm getting exactly the same issue as above. The lines referenced in the deployment error are lines 68-70 of the msbuild file, which relate to a specific TaskGuid.

 All three of us working on the project are Farm Administrators, and all get the same error - so it's not related to the ID of the person deploying the InfoPath Form.

 One other really frustrating thing - how come the processes will deploy one day, then the next day they don't - even when the process in question hasn't been amended in any way? When we make changes to other KPRX files, then deploy the solution, it gets screwed. I know that excluding the unamended kprx files from the build would have prevented the problem, but unfortunately it's a little late for that one right now. :(

I also found this problem when I was trying to deploy a process integrated with InfoPath form. The InfoPath form was set to be viewed in Web Browser.

After that, I'd changed the setting to deploy the InfoPath to be viewed in InfoPath. The error disappeared. And then I changed back the form to be viewed in Web Browser and deploy again, no more errors now! ^__^

Add me to the list of very frustrated victims on this issue. One day I'm deploying InfoPath integrated process no problem. The next day I get the same errors reported here no matter what I try. I will open a support ticket too and point them here, but in case anyone else is thinking about trying different workarounds, here are all the things that did NOT work for me:

  1. I was already one of the site collection administrators
  2.  Adding myself to the Farm Administrators group and running IISReset
  3. Changing the form mode from "InfoPath" to "Web Browser" and back (which apparently did work for some here, but not me)
  4. Deleting the culprit .msbuild file to force K2 to generate from scratch
  5. Deployed while running the K2 Server in Console Mode (no errors show in the console)
  6. Many possible configurations of the InfoPath integration including pulling the form in from SharePoint, Local Drive, and many other combinations of wizard settings
  7. Completely deleting old process using dbo.wProcDelete, rebooting all servers / clients, and starting a new project from scratch
  8. Ran VS.Net as domainadministrator to see if I could get another user to successfully deploy even though my user is already a member of Domain Admins

Other Notes:

  1. I am running the latest 0803 release of Blackpearl
  2. Removing the InfoPath integration from the process I am able to deploy without any problems. Re-adding InfoPath integration it fails.

Anyone tried / figured out any other workarounds to this? Any word back from Support on those tickets already submitted?

After some more extensive testing I have found other scenarios that can lead to this error and some workarounds.

If you're having this problem on every InfoPath Integrated process that you attempt to deploy, you might try running the K2 Configuration Manager again, pointing your client at a different K2 server, and then re-running it to point back at the original K2 server. I know this won't be an option for everyone, but I had an extra K2 server "sandbox" and this seemed to let me get some of my InfoPath Integrated processes deploying successfully, which allowed me to troubleshoot further.

I also found that there are possible Form Library configurations that can cause this problem. In my case, I had set the Form Deployment Location in the InfoPath Integration Wizard to a Form Library with the following characteristics:
1) Allow managing multiple content types = YES
2) Original default Form Content Type deleted
3) Managing a single Content Type that matched the content type of the Form I was deploying.
Blackpearl did not seem to like the fact that I had deleted the original system Content Type "Form" from the library Content Types

So, if you're having this error and none of the other solutions have worked for you, double-check your Form Deployment Location(s) in your InfoPath Integration. I also highly recommend the built-in feature of the InfoPath Integration Wizard to create a new Form Library as the Deployment Location on the fly. Next to that field click [Browse] and then click [Create]. This should prevent that problem from happening (for those reasons at least).