javax.jcr.Session
is not a service and thus can not be injected with @Reference
annotation.
To get the session you could do following -
In AEM 6.x, you are suppose to use code like this.
/**
* Gets the service resource resolver.
*
* @return resourceResolver.
* @throws LoginException - exception if unable to login to repo.
*/
public static ResourceResolver getServiceResourceResolver(ResourceResolverFactory resourceResolverFactory) throws LoginException {
final Map<String, Object> authParam = new HashMap();
authParam.put(ResourceResolverFactory.SUBSERVICE, APPLICATION_READER_SUBSERVICE.value());
return resourceResolverFactory.getServiceResourceResolver(authParam);
}
You could refer here of sample implementation of the above approach