I've tried to deploy an application that works correctly on Glassfish 3 but found that it doesn't work on Glassfish4.
To make it work I've to override MyApplication#getClasses and make it return a Set that contains all application's resources.
The specification states that :
"When an Application subclass is present in the archive, if both Application.getClasses and
Application.getSingletons return an empty list then all root resource classes and providers
packaged in the web application MUST be included and the JAX-RS implementation is REQUIRED
to discover them automatically. If either getClasses or getSingletons returns a non-empty list
then only those classes or singletons returned MUST be included in the published JAX-RS application."
if my application contains a subclass of Application that returns empty lists resource classes are not included or JAX-RS doesn't automatically discover them.