AEM 6.4 onwards please create Resource Resolver Service
Add Resolver Factory create resolver using service user as shown above
For more details: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-6-4-beta-apache-sling-jcr-resource-resolver-not-present/qaq-p/256374