Monday, October 13

Null reference exception when trying to open the BTS admin console

BizTalk Administration Console applications node throws the error 'object reference not set to an instance of an object' and refuses to open

I have been having issues with WMI on my dev VM. It literally feels like the VM is a living thing! I come in in the morning and it presents me with a brand new issue to resolve each day. Being on a time-starined project and therefore not having the time to rebuild the entire VM, I keep 'patching' the VM just to cross the finish line. It must be noted that none of the issues affect the actual code I am developing, just the environment in which I have to unit test things before handing over to test.

So the latest one this grey monday morning was this: I started up the VM, opened BizTalk server admin console and presto! I get an error when trying to expand the applications node. The error is basically that dreaded 'object reference not set to an instance of an object' error that every developer using Microsoft / .Net products dreads. The schpiel is a litany of the sort 'microsoft.biztalk.exceptionmessagebox.btsexceptionmessagebox' blah blah blah... but I had no doubt whatsoever (and still have none) that it wouldn't lead me any closer to the real problem.

As it turns out, it is due to the BizTalk WMI namespace being corrupted. I was not surprised to find that out since WMI had been trying to be my nemesis on this project for a few days now, and I have (even surprising myself) somehow managed to limit the time damages and soldier on with the deliveries nonetheless, fixing each new problem it threw at me on a daily basis.

The fix is simple.

Open a command prompt window and browse to the WMI folder (C:\windows\system32\wbem).
Type in the following command (I am using BizTalk 2013, but this problem could happen with any versiobn of BTS, so use the correct folder path)... mofcomp "D:\Program Files (x86)\Microsoft BizTalk Server 2013\Bins32\BTSWMISchema.mof"

That should rebuild your namespaces nicely.

Now try to re-open the BTS admin console and you should be able to see the applications.


Thursday, October 9

Fixing the WMI Connect error when configuring BizTalk Server 2013

Fix: Error occured in CWMI::Connect error during BizTalk Server 2013 configuration

I came across this error randomly whilst configuring a BizTalk server 2013 installation on my dev VM. It led to some head scratching, and ole' google wasn't quite clear with all the solution sposted on there.

After trawling through the suggestions and solving the problme on my VM, I though I'd point out the two step process that worked for me, with references to the relevant posts.

So, my specific problem manifested in a very ugly configuration summary window with only SSO and Rules Engine deployed, and when I clicked on the logfile link in the summary and scrolled through the huge log file (I basically did Ctrl-F and serached for the word 'error'), I found the following error. Error occured in CWMI::Connect
Now, I should mention that this is the second time I got this error on this same VM, and it took me ages to fix the problem the first time. May I also point out that this error seemed to occur both times after a BizTalk server uninstallaion and subsequent re-installation. Apparently, one colleague suggested that stopping the WMI service (Windows Instrumentation Service) before uninstalling BizTalk would avoid this problem. I wish I'd know that earlier, and I am definitely not intending to test the VM now to prove that theory. I decided that this time, I would try to remember the steps that worked the last time and pen them down.

The first bit was this link, obviously written by someone who knows what he's talking about: http://blogs.technet.com/b/configmgrteam/archive/2009/05/08/wmi-troubleshooting-tips.aspx

I basically opened a command window as administrator, copied this bit below and pasted it after relocating thwe prompt to C:\Windows\Syswow64\wbem

FOR /f %s in ('dir /b /s *.dll') do regsvr32 /s %s
Net stop /y winmgmt
FOR /f %s in ('dir /b *.mof *.mfl') do mofcomp %s
Net start winmgmt

The next bit was testing my system32 wbem repository. Using information from this link: http://blogs.technet.com/b/askperf/archive/2012/03/09/unable-to-connect-to-wmi-locally-win32-the-system-cannot-find-the-path-specified.aspx

I moved the command prompt location to C:\Windows\System32\wbem\ and typed the following command:
winmgmt /verifyrepository

This returned the results
wmi repository verification failed
error code 0X8007007E
 
I then used the post by Joson Zhou on this thread: http://social.technet.microsoft.com/forums/windows/en-us/b5f0abba-8a36-457f-912d-81533b6750d4/wmidiag-report-errors

I basically stopped the WMI service, then browsed to C:|Windows\System32\wbem\Repository and copied all the files in there to a safe location, then deleted all the files in the folder.

I then re-started the VM.

I tried to re-configure BizTalk Server 2013 after those steps and voila! It worked.