I just had this problem on my 2007 XJ. I had been away for a while and when I got back the engine turned over and started fine. However the error "cannot apply park brake" was showing. I also had a check engine warning.
The battery was old so I purchased and installed a new one before getting to diagnose the problems.
I started the car and the brake error message had changed to "press foot brake and engage parking brake" . When I did that the problem resolved. Also the check engine light was no longer showing. Seems to me from this experience that the cars electronics are very sensitive to the battery voltage. Maybe I should replace the battery more often.