Do not know why my question was deleted.
I've configured LDAP Callback functionality in CQ5.6.1 and my code is as below -
public class SyncUser implements com.day.crx.security.ldap.sync.Callback{ @Override public void onUserSync(User userToBeSynched, Map<String, Value[]> attributes, ValueFactory valueFactory) throws RepositoryException { Iterator iter = attributes.entrySet().iterator(); while (iter.hasNext()) { Map.Entry mEntry = (Map.Entry) iter.next(); javax.jcr.Value val = (javax.jcr.Value)mEntry.getValue(); // Error** [Ljavax.jcr.Value; cannot be cast to javax.jcr.Value System.out.println(mEntry.getKey() + " : " + val.getString()); } }
I'm getting error while type casting Value object to fetch all the entries from map.
java.lang.ClassCastException: [Ljavax.jcr.Value; cannot be cast to javax.jcr.Val
ue
at com.ldaptest.SyncUser.onUserSync(SyncUser.java:76)
at com.day.crx.security.ldap.LDAPUserSync$SyncOperation.notifyCallback(L
DAPUserSync.java:697)
at com.day.crx.security.ldap.LDAPUserSync$SyncOperation.sync(LDAPUserSyn
c.java:509)
at com.day.crx.security.ldap.LDAPUserSync$SyncOperation.syncUser(LDAPUse
rSync.java:430)
at com.day.crx.security.ldap.LDAPUserSync$SyncUserOperation.sync(LDAPUse
rSync.java:345)
at com.day.crx.security.ldap.LDAPUserSync$SyncOperation.initAndSync(LDAP
UserSync.java:419)
at com.day.crx.security.ldap.LDAPUserSync.performUpdate(LDAPUserSync.jav
a:264)
at com.day.crx.security.ldap.LDAPUserSync.syncUser(LDAPUserSync.java:173
)
at com.day.crx.security.ldap.LDAPLoginModule.commit(LDAPLoginModule.java
:364)
Appriciate your help. Many thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
java.lang.ClassCastException: [Ljavax.jcr.Value; cannot be cast to javax.jcr.Val
ue
javax.jcr.Value val = (javax.jcr.Value)mEntry.getValue();
mEntry.getValue() is an Array, you cannot cast it to a
javax.jcr.Value.
Just iterate over the returned array and see.
HTH.
Rakesh.
Views
Replies
Total Likes
java.lang.ClassCastException: [Ljavax.jcr.Value; cannot be cast to javax.jcr.Val
ue
javax.jcr.Value val = (javax.jcr.Value)mEntry.getValue();
mEntry.getValue() is an Array, you cannot cast it to a
javax.jcr.Value.
Just iterate over the returned array and see.
HTH.
Rakesh.
Views
Replies
Total Likes