LDAP user sync with AEM 5.6.1 | Community
Skip to main content
October 16, 2015
Solved

LDAP user sync with AEM 5.6.1

  • October 16, 2015
  • 1 reply
  • 1388 views

i've managed to integrate ldap with AEM and am able to sync individual users using the syncUser call in the com.adobe.granite.ldap (Tools) jmx page. I would like to make use of the syncUserList call to sync more than one user lists. Whats the format of the input i should give in for this? Form the error.log it looks like it's expecting a json input, however i'm not sure what's the exact format. I couldn't find any documentation for this as well.

Also i went thorugh the post @ http://helpx.adobe.com/experience-manager/kb/how-to-synchronize-user-with-ldap.html and was interested in the 3rd option i.e. Creating JMX client that uses LDAP MBean. However i wasn't able to connect using rmi. The following is the error stack trace that i got:

Exception in thread "main" java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: java.io.EOFException] at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:334) at javax.management.remote.JMXConnectorFactory.connect(JMXConnectorFactory.java:259) at com.test.user.ldap.LDAPSampleClient.main(LDAPSampleClient.java:21) Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: java.io.EOFException] at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:113) at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:197) at javax.naming.InitialContext.lookup(InitialContext.java:455) at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI(RMIConnector.java:1882) at javax.management.remote.rmi.RMIConnector.findRMIServer(RMIConnector.java:1852) at javax.management.remote.rmi.RMIConnector.connect(RMIConnector.java:268) ... 2 more Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: java.io.EOFException at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:298) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:196) at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:334) at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:89) at com.sun.jndi.rmi.registry.RegistryContext.lookup(RegistryContext.java:109) ... 7 more Caused by: java.io.EOFException at java.io.DataInputStream.readByte(DataInputStream.java:261) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:240) ... 11 more

Could anyone please help me out with the above two issues?

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by rakesh_kumar1

Hi,

 

There is no need to look through remote way as given in the example - http://helpx.adobe.com/experience-manager/kb/how-to-synchronize-user-with-ldap.html.

Below is the way to look for remote MBeans.

MBeanServerConnection server = (MBeanServerConnection) JMXConnectorFactory.connect(new JMXServiceURL(serverUrl), null).getMBeanServerConnection();

 

// Below code will suffice your need. This code is working for me in CQ

Create one DynamicBean interface exposing the same operation present in JMX for runtime dispatch.

import javax.management.DynamicMBean; /** * Proxy interface for JMX Bean. */ public interface LDAPUserMBean extends DynamicMBean { /** * Proxy method for {@link com.day.crx.security.ldap.jmx.LDAPUserMBean} * syncUser method. * * @param user the user * @return the string[] */ public String[] syncUser(String user); }

// Create ObjectName

String OBJECT_NAME = "com.adobe.granite.ldap:host=<your LDAP host>,port=<Port>,type=Tools"; MBeanServerConnection server = ManagementFactory.getPlatformMBeanServer(); //returns a reference to the existing MBean server within the JVM. ObjectName name = new ObjectName(OBJECT_NAME); LDAPUserMBean ldap = JMX.newMBeanProxy(server, name, LDAPUserMBean.class); ldap.syncUser("userDN");

HTH.

I have answered similar question last year - http://forums.adobe.com/message/4735940

Thanks,

Rakesh

1 reply

rakesh_kumar1
rakesh_kumar1Accepted solution
Level 2
October 16, 2015

Hi,

 

There is no need to look through remote way as given in the example - http://helpx.adobe.com/experience-manager/kb/how-to-synchronize-user-with-ldap.html.

Below is the way to look for remote MBeans.

MBeanServerConnection server = (MBeanServerConnection) JMXConnectorFactory.connect(new JMXServiceURL(serverUrl), null).getMBeanServerConnection();

 

// Below code will suffice your need. This code is working for me in CQ

Create one DynamicBean interface exposing the same operation present in JMX for runtime dispatch.

import javax.management.DynamicMBean; /** * Proxy interface for JMX Bean. */ public interface LDAPUserMBean extends DynamicMBean { /** * Proxy method for {@link com.day.crx.security.ldap.jmx.LDAPUserMBean} * syncUser method. * * @param user the user * @return the string[] */ public String[] syncUser(String user); }

// Create ObjectName

String OBJECT_NAME = "com.adobe.granite.ldap:host=<your LDAP host>,port=<Port>,type=Tools"; MBeanServerConnection server = ManagementFactory.getPlatformMBeanServer(); //returns a reference to the existing MBean server within the JVM. ObjectName name = new ObjectName(OBJECT_NAME); LDAPUserMBean ldap = JMX.newMBeanProxy(server, name, LDAPUserMBean.class); ldap.syncUser("userDN");

HTH.

I have answered similar question last year - http://forums.adobe.com/message/4735940

Thanks,

Rakesh