Are you running this code as an OSGI service, or as stand-alone class? You may not be able to use @Reference without being in an OSGi container, it is Felix that's providing the service. There is an example on how to use Querybuilder with OSGIhttps://helpx.adobe.com/experience-manager/using/using-q...