Jihad: The forgotten obligation
30: Practising Spear Throwing in the Masjid
Narrated Abu Huraira (ra) while some Ethiopians were playing in the presence of the Prophet (saw) with spears, Umar (ra) came in, picked a stone and hit them with it. Upon that the Prophet (saw) said, "O Umar! allow them to play". Ma'mar (the subnarrator) added that they were playing in the masjid). (Sahih Bukhari, p.406, vol.1)
Imam Bukhari (ra) has placed this hadith in the chapter of Jihaad which is obvious that, because spear-throwing is a part of Jihaad and Jihaad is an act of worship, so this is why it was permitted in the masjid.
It is probable that Umar (ra) did not see the Prophet (saw) so he tried to stop them playing with spears in the masjid, or he saw the Prophet (saw) but thought that the Prophet (saw) was maybe feeling uncomfortable to stop them. So he tried to stop them himself, but the Prophet (saw) advised Umar (ra) to allow them to play with the spears. If only the Muslims today would have gatherings involving spears and do war training together like in the time of the Prophet (saw), so that every person from the Muslims would be a Mujahid and would be able to protect himself, his deen and defend his Muslim brothers and sisters.