Not able to inject ResouceResolverFactory

Avatar

Avatar

umeshj24393

Avatar

umeshj24393

umeshj24393

27-05-2017

Hi,

Not able to inject resouceresolverfactory in following code.

I created an interface

public interface WriteService{

    public void getSession();

{

And a class which implemented an interface

@Component(immediate=true) @Service(value = WriteSerive.class) public class WriteServiceImp  implements WriteService { @Reference private ResourceResolverFactory resourceFactory; @Override public void getSession(){ try{ Map<String,Object> paramMap = new HashMap<String,Object>(); paramMap.put(ResourceResolverFactory.SUBSERVICE, "connectSession"); ResourceResolver rr = null; rr = resourceFactory.getServiceResourceResolver(paramMap); Sessionsession = rr.adaptTo(Session.class); } catch(Exception e){ } }

 

Any Suggestion?

Thanks in advance

View Entire Topic

Avatar

Avatar

umeshj24393

Avatar

umeshj24393

umeshj24393

28-05-2017

Yes, I have configured the user mapping configuration in system console. 

In osgi bundles, wherever the .loginAdministrstive(null) is called , i have replaced by below written codes:-

  1. @Component(immediate=true) @Service(value = WriteSerive.class) public class WriteServiceImp implements WriteService { @Reference private ResourceResolverFactory resourceFactory; @Override public void getSession(){ try{ Map<String,Object> paramMap = new HashMap<String,Object>(); paramMap.put(ResourceResolverFactory.SUBSERVICE, "connectSession"); ResourceResolver rr = null; rr = resourceFactory.getServiceResourceResolver(paramMap); Sessionsession = rr.adaptTo(Session.class); } catch(Exception e){ } }