Took me half an hour today to figure this out when deploying to production servers. Apparently, the CDI extension loaded from a JAR in a WAR, thus different classloader, makes it uninjectable.

The problem can be fixed by simply disable implicit CDI on GlassFish

${GLASSFISH_HOME}/bin/asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=false