In AEM 6.4, you get a session instance (required to work with the JCR API) by using a Sling method named getServiceResourceResolver(). The following code shows use of the more secure getServiceResourceResolver API call.
Map<String, Object> param = new HashMap<String, Object>();
ResourceResolver resolver = null;
//Invoke the adaptTo method to create a Session used to create a QueryManager
resolver = resolverFactory.getServiceResourceResolver(param);
session = resolver.adaptTo(Session.class);
This article creates the following AEM HTL component that displays data queried from the AEM JCR.
To read this development article, click https://helpx.adobe.com/experience-manager/using/querying-experience-manager-64.html.