private void resetSAAJFactories() { // SAAJMetaFactory caches the instance; use reflection to reset it between test runs. // Note that the other factories are OK. try { Field field = SAAJMetaFactory.class.getDeclaredField("instance"); field.setAccessible(true); field.set(null, null); } catch (Throwable ex) { throw new Error(ex); } }