I would argue that the preference would depend on the company, so it will probably vary to some extent.
For the firm I'm currently working for, we would probably put slightly more weight on the person with 3 years of experience in mainframes, but only if they have some
Java EE experience as well - otherwise, it doesn't matter which of them has more experience or certifications. (Because when we're asking for 2-3 years experience, we're talking 2-3 years of experience in the Java EE space, and inexperience with those skills isn't useful to us.) But at least as far as your question goes, as far as between those two proposed examples, I'd pass on both and continue looking for a suitable candidate.