Nucleation of vortices in a rotating Bose-Einstein condensate