Grappling with personnel shortages, companies are training women in jobs traditionally done by men—but there are hurdles