how to use EventHandler | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
arunpatidar
arunpatidarAccepted solution
New Participant
Sep 11, 2018 12:35 PM UTC

Hi,

You are mixing osgi and Felix annotation.

Please use only osgi annotaions

remove org.apache.felix.scr.annotations.Reference and use import org.osgi.service.component.annotations.Reference;

Arun Patidar

14 replies

arunpatidar
New Participant
Sep 11, 2018 12:17 PM UTC

Can you share your imports?

Translate
Arun Patidar
熊先森Author
New Participant
Sep 11, 2018 12:16 PM UTC

i  don't know  because of  this  ”EventHandler“ 

all I received both of them are null

Translate
熊先森Author
New Participant
Sep 11, 2018 12:05 PM UTC


i

Translate
arunpatidar
New Participant
Sep 11, 2018 12:00 PM UTC

Hi,

What are you trying to do,

you can get resource resolver from subservice user.

and then get appropriate objects value not null.

@Reference

  private ResourceResolverFactory resourceResolverFactory;

ResourceResolver resourceResolver = null;

  try {

        Map<String, Object> serviceParams = new HashMap<String, Object>();

    serviceParams.put(ResourceResolverFactory.SUBSERVICE, "training");

    resourceResolver = resourceResolverFactory.getServiceResourceResolver(serviceParams);

  } catch (LoginException e) {

  e.printStackTrace();

  }

Translate
Arun Patidar