Database access works now! NetBeans created the persistence xml in "src/main/setup/glassfish-resources.xml", which was wrong. For webapps it has to be in: "src/main/webapp/WEB-INF/glassfish-resources.xml". See: https://blogs.oracle.com/JagadishPrasath/entry/application_scoped_resources_in_glassfish