Expand my Community achievements bar.

SOLVED

Calling jmx service with osgi service

Avatar

Level 7

Hello,

I want to synchronise all user within the instance to particular time. Normaly doing a scheduled job by creating a service and an appropiate config. But how can I achive it with a jmx service? In example synchronsing groups and users from ldap seems only be available as jxm service. 

1 Accepted Solution

Avatar

Correct answer by
Level 7

I found a suitable way to call a jmx service from AEM. This way is documented at https://kbwebconsult.com/aem-automatic-user-synchronization-with-ldap. It can also be found here in this forum at https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-ldap-synchronization-s...

The pitfall for AEM 6.5 is the string to create the nessecary domain. The presented syntax did not work at me. To solve this issue I used the tool Jconsole wich is provided by java jdk it self.

View solution in original post

8 Replies

Avatar

Level 7

Uhm why shall I create a new mbean when the user sync is already provided as this ? 

Avatar

Community Advisor

Sorry, I misread the question. I thought you wanted to use JMX for your services.

 

But I am not sure if it is possible to call JMX services from another OSGI service. Although JMX mbean is also a service, so you should be able to call it from another OSGI service if the LDAP service is exported. You can try though.



Arun Patidar

Avatar

Level 7

@kautuk_sahni  Why did you mark this answer as correct? You should give a questioner enough time for a try. Btw at least the questioner is in charge to mark an answer as correct.

Avatar

Administrator

@Magicr, Thank you for the feedback, I have unmarked the above as the correct answer. 

 



Kautuk Sahni

Avatar

Community Advisor

I think you can use OSGi ServiceTracker to get the service you wanted from OSGi and then call the user synchronization method.

 

protected void activate(final ComponentContext componentContext) {
        this.serviceTracker = new ServiceTracker(
            componentContext.getBundleContext(),
            SERVICE.class.getName(),
            null
        );
        this.serviceTracker.open();
    }

----
this.serviceTracker.getService().userSync(); 

 

Avatar

Level 7

Hello, after long time and lots of serveral tries it ends into a dead end. I was unable to get the jmx service with this way.

Avatar

Correct answer by
Level 7

I found a suitable way to call a jmx service from AEM. This way is documented at https://kbwebconsult.com/aem-automatic-user-synchronization-with-ldap. It can also be found here in this forum at https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-ldap-synchronization-s...

The pitfall for AEM 6.5 is the string to create the nessecary domain. The presented syntax did not work at me. To solve this issue I used the tool Jconsole wich is provided by java jdk it self.