Excitation of resonators by electron beams