two years after his father 's death , despite the fact that he had n't produced an heir to ensure the succession , jordan had bought a commission in the army and gone to spain to fight against napoleon 's troops .