The relevant quote from the DMG, p. 68:
All characters earn experience for victory over their foes. There are two important things to bear in mind here. First, this award applies only to foes or enemies of the player characters—the monster or NPC must present a real threat. Characters never receive experience for the defeat of non-hostile creatures (rabbits, cattle, deer, friendly unicorns) or NPCs (innkeepers, beggars, peasants). Second, no experience is earned for situations in which the PCs have an overwhelming advantage over their foes.

A 7th-level player character who needs one more experience point to advance in level can’t just gather his friends together and hunt down a single orc. That orc wouldn’t stand a chance, so the player character was never at any particular risk...