Two soldiers have been killed and a third wounded when a fellow recruit opened fire at a training range in central Japan, the military has said.