Port fixes for GlassFish from 1.0.x, which use a different API