Efficient multi-Josephson junctions oscillator using a cavity