Du Fu

The greatest Chinese poet Du Fu failed the imperial examinations. Was it because he was not good at writing essays? Or was the reason political? Did Du Fu lack the acumen to be a bureaucrat?