Are you getting the same ClassCastException as the root cause of the search?
Mert Çalışkan wrote:
Hey, via jdni calls I guess, seam's ldap-identity-store is taking care of... lemme elaborate the case, Actually before creating a user, the seam framework is doing a search with userExists method. public boolean userExists(String name) { InitialLdapContext ctx = null; try { ctx = initialiseContext(); String[] userAttr = {getUserNameAttribute()}; SearchControls controls = new SearchControls(); controls.setSearchScope(searchScope); controls.setReturningAttributes(userAttr); controls.setTimeLimit(getSearchTimeLimit()); StringBuilder userFilter = new StringBuilder(); Object[] filterArgs = new Object[getUserObjectClasses().length]; for (int i = 0; i < getUserObjectClasses().length; i++) { userFilter.append("("); userFilter.append(getObjectClassAttribute()); userFilter.append("={"); userFilter.append(i); userFilter.append("})"); filterArgs[i] = getUserObjectClasses()[i]; } NamingEnumeration answer = ctx.search(getUserContextDN(), userFilter.toString(), filterArgs, controls); while (answer.hasMore()) { SearchResult sr = (SearchResult) answer.next(); Attributes attrs = sr.getAttributes(); Attribute user = attrs.get(getUserNameAttribute()); for (int i = 0; i < user.size(); i++) { Object value = user.get(i); if (name.equals(value)) { answer.close(); return true; } } } answer.close(); return false; } catch (NamingException ex) { throw new IdentityManagementException("Error getting users", ex); } finally { if (ctx != null) { try { ctx.close(); } catch (NamingException ex) {} } } } and this is throwing out, Caused by: org.jboss.seam.security.management.IdentityManagementException: Error getting users at org.jboss.seam.security.management.LdapIdentityStore.userExists(LdapIdentityStore.java:1235) at org.jboss.seam.security.management.IdentityManager.userExists(IdentityManager.java:172) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335) ... 79 more Caused by: javax.naming.CommunicationException: Request: 2 cancelled; remaining name 'ou=people,o=mycompany' at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:60) at com.sun.jndi.ldap.Connection.readReply(Connection.java:411) M On Wed, Apr 22, 2009 at 3:55 PM, Yiannis Mavroukakis < [email protected]> wrote:How are you creating this new person? Via JNDI calls or through the DS API? Y. Mert Çalışkan wrote:Hi, I'm integrating the seam framework's user management module with ApacheDS ldap. For creating a new user (person objectClass) in the DS I got the error below, So apacheDS is forcing the client to close the conn since it gets a classcast. I'm on 1.5.4 version. How to debug & solve this? Any clues? Thanks, M Trace: [15:39:46] WARN [org.apache.directory.server.ldap.LdapProtocolHandler] - [/ 127.0.0.1:2453] Unexpected exception forcing session to close: sending disconnect notice to client. *org.apache.mina.filter.codec.ProtocolDecoderException: java.lang.ClassCastException: org.apache.directory.shared.ldap.co dec.search.AttributeValueAssertionFilter cannot be cast to org.apache.directory.shared.ldap.codec.search.ConnectorFilter* (Hexdump: 30 81 82 02 01 02 63 60 04 17 6F 75 3D 70 65 6F 70 6C 65 2C 6F 3D 6F 6E 74 6F 6D 65 74 72 69 63 73 0A 01 02 0 A 01 03 02 01 00 02 01 0B 01 01 00 A3 15 04 0B 6F 62 6A 65 63 74 43 6C 61 73 73 04 06 70 65 72 73 6F 6E A3 18 04 0B 6F 6 2 6A 65 63 74 43 6C 61 73 73 04 09 75 69 64 4F 62 6A 65 63 74 30 05 04 03 75 69 64 A0 1B 30 19 04 17 32 2E 31 36 2E 38 3 4 30 2E 31 2E 31 31 33 37 33 30 2E 33 2E 34 2E 32) at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:165) at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:6 48) at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassCastException: org.apache.directory.shared.ldap.codec.search.AttributeValueAssertionFilter can not be cast to org.apache.directory.shared.ldap.codec.search.ConnectorFilter at org.apache.directory.shared.ldap.codec.search.SearchRequest.addCurrentFilter(SearchRequest.java:356) at org.apache.directory.shared.ldap.codec.actions.InitEqualityMatchFilterAction.action(InitEqualityMatchFilterAc tion.java:70) at org.apache.directory.shared.asn1.ber.grammar.AbstractGrammar.executeAction(AbstractGrammar.java:153) at org.apache.directory.shared.asn1.ber.Asn1Decoder.treatTLVDoneState(Asn1Decoder.java:620) at org.apache.directory.shared.asn1.ber.Asn1Decoder.decode(Asn1Decoder.java:796) at org.apache.directory.shared.ldap.codec.TwixDecoder.decode(TwixDecoder.java:110) at org.apache.directory.shared.ldap.message.MessageDecoder.decode(MessageDecoder.java:150) at org.apache.directory.shared.asn1.codec.Asn1CodecDecoder.decode(Asn1CodecDecoder.java:53) at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:158) ... 8 more [15:39:46] WARN [org.apache.directory.server.ldap.LdapProtocolHandler] - Null LdapSession given to cleanUpSession. [15:39:46] WARN [org.apache.directory.server.ldap.LdapProtocolHandler] - Null LdapSession given to cleanUpSession.
