edited for Glassfish 3.1.1