You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@directory.apache.org by Mert Çalışkan <mc...@gmail.com> on 2009/04/22 14:45:01 UTC

classcast on ApacheDS

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.

Re: classcast on ApacheDS

Posted by Mert Çalışkan <mc...@gmail.com>.
and one more thing to add,
I modified the person objectClass to add roles and enabled attributes...
an LDIF that I used for this is attached...,

M

2009/4/22 Mert Çalışkan <mc...@gmail.com>

> and with the same LDIF, it works ok on openldap...
> if there are some ways to debug this, I can get that done...
>
> M
>
> 2009/4/22 Mert Çalışkan <mc...@gmail.com>
>
> yes, when that method executes, my ApacheDS server (standalone working one)
>> throws that error.
>>
>>
>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>
>> 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 <
>>>> imavroukakis@gameaccount.com> 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.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>

Re: classcast on ApacheDS

Posted by Mert Çalışkan <mc...@gmail.com>.
and with the same LDIF, it works ok on openldap...
if there are some ways to debug this, I can get that done...

M

2009/4/22 Mert Çalışkan <mc...@gmail.com>

> yes, when that method executes, my ApacheDS server (standalone working one)
> throws that error.
>
>
> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>
> 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 <
>>> imavroukakis@gameaccount.com> 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.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>

Re: classcast on ApacheDS

Posted by Yiannis Mavroukakis <im...@gameaccount.com>.
aaah...evil seam...all the same, I'd go for 1.5.5, loads of fixes, plus 
uses "new" MINA.

Mert Çalışkan wrote:
> Hey,
>
> There was a bug in seam's LdapIdentityStore class (that holds the userExists
> method) while doing the filtering..
> Problem solved now.
>
> Thanks all,
>
> M.
>
>
> 2009/4/22 Alex Karasulu <ak...@gmail.com>
>
>   
>> Hi Mert, Yiannis,
>>
>> Yiannis is right on this one.  We fixed a lot of bugs in 1.5.5 and I think
>> it may impact this scenario.  Give it a try and let us know.  1.5.5 should
>> be out here in a week or so.  We apologize for the delays.
>>
>>
>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>
>>     
>>> I go via the "build your own" route to be honest, just get the entire
>>> source tree via SVN and do a mvn -Dmaven.test.skip=true install
>>>
>>> Y.
>>>
>>>
>>> Mert Çalışkan wrote:
>>>
>>>       
>>>> ok,
>>>> is there any nightly builds? or I should do it myself?
>>>>
>>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>>
>>>>
>>>>
>>>>         
>>>>> Sorry I meant build off of the SVN branch, this is what I am using.
>>>>>
>>>>>
>>>>> Mert Çalışkan wrote:
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>> 1.5.5?
>>>>>> latest downloads are only for 1.5.4, no?
>>>>>> http://directory.apache.org/apacheds/1.5/downloads.html
>>>>>>
>>>>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> Have you tried this with 1.5.5 ?
>>>>>>>
>>>>>>>
>>>>>>> Mert Çalışkan wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> yes, when that method executes, my ApacheDS server (standalone
>>>>>>>>                 
>> working
>>     
>>>>>>>> one)
>>>>>>>> throws that error.
>>>>>>>>
>>>>>>>>
>>>>>>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> 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 <
>>>>>>>>>> imavroukakis@gameaccount.com> 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.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>         
>> --
>> Alex Karasulu
>> My Blog :: http://www.jroller.com/akarasulu/
>> Apache Directory Server :: http://directory.apache.org
>> Apache MINA :: http://mina.apache.org
>>
>>     
>
>   

Re: Weird error when modifying a single attribute

Posted by Ioannis Mavroukakis <im...@gameaccount.com>.
Emamanuel, don't worry I found the mistake..worst case of pebcak on my  
behalf ever it's almost
embarassing..apologies to have wasted your time
On 2 Jun 2009, at 19:27, Ioannis Mavroukakis wrote:

> Sure, is this project in the main trunk?
>
>
> On 2 Jun 2009, at 18:43, Emmanuel Lecharny wrote:
>
>> Yiannis Mavroukakis wrote:
>>> Mega slow email, sorry for the late reply,
>>>
>>> Here is the code that does the modify (used to work under OpenLDAP)
>>>
>>> LdapContext ctx = JNDIUtils.lookup( LdapContext.class ,
>>>      "external/ldap/gameaccount" );
>>>      LdapRecord record = null;
>>>      LdapContext dir = JNDIUtils.lookup( ctx , "ou=Player" );
>>>            Attributes attrs = new BasicAttributes();
>>>            BasicAttribute oc = new BasicAttribute( "objectClass" );
>>>      oc.add( "top" );
>>>      oc.add( "person" );
>>>      oc.add( "organizationalPerson" );
>>>      oc.add( "inetOrgPerson" );
>>>      oc.add( "gaPlayer" );
>>>      attrs.put( oc );
>>>      put( attrs , "cn" , alias );
>>>      attrs.put( "userPassword", password.getBytes() );
>>>      dir.modifyAttributes( createLdapName( new Rdn( "cn", alias ) ),
>>>              LdapContext.REPLACE_ATTRIBUTE, attrs );
>>
>> I have the same test working (slightly different, nut not that  
>> much) :
>>
>>      try
>>      {
>>          DirContext systemCtx = ( DirContext )  
>> getWiredContext( ldapService ).lookup( "ou=system" );
>>          String rdn = "cn=Kate Bush";
>>            Attributes attrs = new BasicAttributes();
>>          BasicAttribute oc = new BasicAttribute( "objectClass" );
>>          oc.add( "top" );
>>          oc.add( "person" );
>>          oc.add( "organizationalPerson" );
>>          oc.add( "inetOrgPerson" );
>>          attrs.put( oc );
>>          attrs.put( "cn" , "Kate Bush" );
>>          attrs.put( "userPassword", "test".getBytes() );
>>          systemCtx.modifyAttributes( rdn,
>>                    LdapContext.REPLACE_ATTRIBUTE, attrs );
>>      }
>>
>> Can you add your own test in the server-integ project (operations - 
>> > modify) and give us the result ?
>>
>> Thanks !
>>
>> -- 
>> --
>> cordialement, regards,
>> Emmanuel Lécharny
>> www.iktek.com
>> directory.apache.org
>>
>>
>>
>> ______________________________________________________________________
>> This email has been scanned by the MessageLabs Email Security System.
>> For more information please visit http://www.messagelabs.com/email  
>> ______________________________________________________________________
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email______________________________________________________________________
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email______________________________________________________________________


Re: Weird error when modifying a single attribute

Posted by Ioannis Mavroukakis <im...@gameaccount.com>.
Sure, is this project in the main trunk?


On 2 Jun 2009, at 18:43, Emmanuel Lecharny wrote:

> Yiannis Mavroukakis wrote:
>> Mega slow email, sorry for the late reply,
>>
>> Here is the code that does the modify (used to work under OpenLDAP)
>>
>> LdapContext ctx = JNDIUtils.lookup( LdapContext.class ,
>>       "external/ldap/gameaccount" );
>>       LdapRecord record = null;
>>       LdapContext dir = JNDIUtils.lookup( ctx , "ou=Player" );
>>             Attributes attrs = new BasicAttributes();
>>             BasicAttribute oc = new BasicAttribute( "objectClass" );
>>       oc.add( "top" );
>>       oc.add( "person" );
>>       oc.add( "organizationalPerson" );
>>       oc.add( "inetOrgPerson" );
>>       oc.add( "gaPlayer" );
>>       attrs.put( oc );
>>       put( attrs , "cn" , alias );
>>       attrs.put( "userPassword", password.getBytes() );
>>       dir.modifyAttributes( createLdapName( new Rdn( "cn", alias ) ),
>>               LdapContext.REPLACE_ATTRIBUTE, attrs );
>
> I have the same test working (slightly different, nut not that much) :
>
>       try
>       {
>           DirContext systemCtx = ( DirContext )  
> getWiredContext( ldapService ).lookup( "ou=system" );
>           String rdn = "cn=Kate Bush";
>             Attributes attrs = new BasicAttributes();
>           BasicAttribute oc = new BasicAttribute( "objectClass" );
>           oc.add( "top" );
>           oc.add( "person" );
>           oc.add( "organizationalPerson" );
>           oc.add( "inetOrgPerson" );
>           attrs.put( oc );
>           attrs.put( "cn" , "Kate Bush" );
>           attrs.put( "userPassword", "test".getBytes() );
>           systemCtx.modifyAttributes( rdn,
>                     LdapContext.REPLACE_ATTRIBUTE, attrs );
>       }
>
> Can you add your own test in the server-integ project (operations ->  
> modify) and give us the result ?
>
> Thanks !
>
> -- 
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email  
> ______________________________________________________________________


Re: Weird error when modifying a single attribute

Posted by Emmanuel Lecharny <el...@apache.org>.
Yiannis Mavroukakis wrote:
> Mega slow email, sorry for the late reply,
>
> Here is the code that does the modify (used to work under OpenLDAP)
>
> LdapContext ctx = JNDIUtils.lookup( LdapContext.class ,
>        "external/ldap/gameaccount" );
>        LdapRecord record = null;
>        LdapContext dir = JNDIUtils.lookup( ctx , "ou=Player" );
>              Attributes attrs = new BasicAttributes();
>              BasicAttribute oc = new BasicAttribute( "objectClass" );
>        oc.add( "top" );
>        oc.add( "person" );
>        oc.add( "organizationalPerson" );
>        oc.add( "inetOrgPerson" );
>        oc.add( "gaPlayer" );
>        attrs.put( oc );
>        put( attrs , "cn" , alias );
>        attrs.put( "userPassword", password.getBytes() );
>        dir.modifyAttributes( createLdapName( new Rdn( "cn", alias ) ),
>                LdapContext.REPLACE_ATTRIBUTE, attrs );

I have the same test working (slightly different, nut not that much) :

        try
        {
            DirContext systemCtx = ( DirContext ) getWiredContext( 
ldapService ).lookup( "ou=system" );
            String rdn = "cn=Kate Bush";
   
            Attributes attrs = new BasicAttributes();
            BasicAttribute oc = new BasicAttribute( "objectClass" );
            oc.add( "top" );
            oc.add( "person" );
            oc.add( "organizationalPerson" );
            oc.add( "inetOrgPerson" );
            attrs.put( oc );
            attrs.put( "cn" , "Kate Bush" );
            attrs.put( "userPassword", "test".getBytes() );
            systemCtx.modifyAttributes( rdn,
                      LdapContext.REPLACE_ATTRIBUTE, attrs );
        }

Can you add your own test in the server-integ project (operations -> 
modify) and give us the result ?

Thanks !

-- 
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org



Re: Weird error when modifying a single attribute

Posted by Yiannis Mavroukakis <im...@gameaccount.com>.
Mega slow email, sorry for the late reply,

Here is the code that does the modify (used to work under OpenLDAP)

LdapContext ctx = JNDIUtils.lookup( LdapContext.class ,
        "external/ldap/gameaccount" );
        LdapRecord record = null;
        LdapContext dir = JNDIUtils.lookup( ctx , "ou=Player" );
       
        Attributes attrs = new BasicAttributes();
       
        BasicAttribute oc = new BasicAttribute( "objectClass" );
        oc.add( "top" );
        oc.add( "person" );
        oc.add( "organizationalPerson" );
        oc.add( "inetOrgPerson" );
        oc.add( "gaPlayer" );
        attrs.put( oc );
        put( attrs , "cn" , alias );
        attrs.put( "userPassword", password.getBytes() );
        dir.modifyAttributes( createLdapName( new Rdn( "cn", alias ) ),
                LdapContext.REPLACE_ATTRIBUTE, attrs );


I also have another issue, this is on startup only, I get the following 
in my logs

13:19:25,482 INFO  [DefaultDirectoryService] ApacheDS shutdown hook has 
been registered with the runtime.
13:19:26,732 ERROR [DefaultAttributeTypeRegistry] attributeType w/ OID 
2.5.4.16 not registered!
13:19:26,890 ERROR [DefaultAttributeTypeRegistry] attributeType w/ OID 
1.3.6.1.4.1.32882.1.1.4 not registered!
13:19:26,892 ERROR [DefaultAttributeTypeRegistry] attributeType w/ OID 
1.3.6.1.4.1.32882.1.1.4 not registered!
13:19:26,894 ERROR [DefaultAttributeTypeRegistry] attributeType w/ OID 
1.3.6.1.4.1.32882.1.1.3 not registered!
13:19:27,091 INFO  [EventInterceptor] Initializing ...
13:19:27,093 INFO  [EventInterceptor] Initialization complete.
13:19:27,231 INFO  [LdapService] Successful bind of an LDAP Service 
(10389) is complete.
13:19:27,231 INFO  [LdapService] Ldap service started.

1.3.6.1.4.1.32882 is our OID, IANA registered..however 2.5.4.16 is 
postalAddress...Eventhough the OID's say they are not
registered on startup I don't have any issues, so far..


Emmanuel Lecharny wrote:
> I will look at the issue.
>
> What exactly are you doing? Replacing the password with a new one ?
>
> 2009/6/2 Yiannis Mavroukakis <im...@gameaccount.com>:
>   
>> Hello fellow listers :-)
>>
>> I've come across an odd issue, while trying to modify a single attribute in
>> LDAP.
>> If I do a wholemeal change of every attribute in my entry it works fine.
>> However if I only try to change
>> the userPassword then it blows up with the following error
>>
>> 3:20:36,026 ERROR [UserActionBean] javax.naming.NamingException: [LDAP:
>> error code 80 - OTHER: failed for     Modify Request
>>       Object :
>> '2.5.4.3=imavroukakis,2.5.4.11=player,0.9.2342.19200300.100.1.25=gameaccount,0.9.2342.19200300.100.1.25=com'
>>           Modification[0]
>>               Operation :  replace
>>               Modification
>>   objectClass: top
>>   objectClass: person
>>   objectClass: organizationalPerson
>>   objectClass: inetOrgPerson
>>   objectClass: gaPlayer
>>           Modification[1]
>>               Operation :  replace
>>               Modification
>>   userPassword: '0x22 ...'
>>           Modification[2]
>>               Operation :  replace
>>               Modification
>>   cn: imavroukakis
>> : null:  <-- not sure why this is null!!
>>
>> Any ideas? I am using the latest trunk.
>>
>> Thanks,
>>
>> Yiannis
>>
>>     
>
>
>
>   

Re: Weird error when modifying a single attribute

Posted by Emmanuel Lecharny <el...@apache.org>.
I will look at the issue.

What exactly are you doing? Replacing the password with a new one ?

2009/6/2 Yiannis Mavroukakis <im...@gameaccount.com>:
>
> Hello fellow listers :-)
>
> I've come across an odd issue, while trying to modify a single attribute in
> LDAP.
> If I do a wholemeal change of every attribute in my entry it works fine.
> However if I only try to change
> the userPassword then it blows up with the following error
>
> 3:20:36,026 ERROR [UserActionBean] javax.naming.NamingException: [LDAP:
> error code 80 - OTHER: failed for     Modify Request
>       Object :
> '2.5.4.3=imavroukakis,2.5.4.11=player,0.9.2342.19200300.100.1.25=gameaccount,0.9.2342.19200300.100.1.25=com'
>           Modification[0]
>               Operation :  replace
>               Modification
>   objectClass: top
>   objectClass: person
>   objectClass: organizationalPerson
>   objectClass: inetOrgPerson
>   objectClass: gaPlayer
>           Modification[1]
>               Operation :  replace
>               Modification
>   userPassword: '0x22 ...'
>           Modification[2]
>               Operation :  replace
>               Modification
>   cn: imavroukakis
> : null:  <-- not sure why this is null!!
>
> Any ideas? I am using the latest trunk.
>
> Thanks,
>
> Yiannis
>



-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Weird error when modifying a single attribute

Posted by Yiannis Mavroukakis <im...@gameaccount.com>.
Hello fellow listers :-)

I've come across an odd issue, while trying to modify a single attribute 
in LDAP.
If I do a wholemeal change of every attribute in my entry it works fine. 
However if I only try to change
the userPassword then it blows up with the following error

3:20:36,026 ERROR [UserActionBean] javax.naming.NamingException: [LDAP: 
error code 80 - OTHER: failed for     Modify Request
        Object : 
'2.5.4.3=imavroukakis,2.5.4.11=player,0.9.2342.19200300.100.1.25=gameaccount,0.9.2342.19200300.100.1.25=com'
            Modification[0]
                Operation :  replace
                Modification
    objectClass: top
    objectClass: person
    objectClass: organizationalPerson
    objectClass: inetOrgPerson
    objectClass: gaPlayer
            Modification[1]
                Operation :  replace
                Modification
    userPassword: '0x22 ...'
            Modification[2]
                Operation :  replace
                Modification
    cn: imavroukakis
: null:  <-- not sure why this is null!!

Any ideas? I am using the latest trunk.

Thanks,

Yiannis

Re: classcast on ApacheDS

Posted by Mert Çalışkan <mc...@gmail.com>.
Hey,

There was a bug in seam's LdapIdentityStore class (that holds the userExists
method) while doing the filtering..
Problem solved now.

Thanks all,

M.


2009/4/22 Alex Karasulu <ak...@gmail.com>

> Hi Mert, Yiannis,
>
> Yiannis is right on this one.  We fixed a lot of bugs in 1.5.5 and I think
> it may impact this scenario.  Give it a try and let us know.  1.5.5 should
> be out here in a week or so.  We apologize for the delays.
>
>
> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>
> > I go via the "build your own" route to be honest, just get the entire
> > source tree via SVN and do a mvn -Dmaven.test.skip=true install
> >
> > Y.
> >
> >
> > Mert Çalışkan wrote:
> >
> >> ok,
> >> is there any nightly builds? or I should do it myself?
> >>
> >> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
> >>
> >>
> >>
> >>> Sorry I meant build off of the SVN branch, this is what I am using.
> >>>
> >>>
> >>> Mert Çalışkan wrote:
> >>>
> >>>
> >>>
> >>>> 1.5.5?
> >>>> latest downloads are only for 1.5.4, no?
> >>>> http://directory.apache.org/apacheds/1.5/downloads.html
> >>>>
> >>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>> Have you tried this with 1.5.5 ?
> >>>>>
> >>>>>
> >>>>> Mert Çalışkan wrote:
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>> yes, when that method executes, my ApacheDS server (standalone
> working
> >>>>>> one)
> >>>>>> throws that error.
> >>>>>>
> >>>>>>
> >>>>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>> 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 <
> >>>>>>>> imavroukakis@gameaccount.com> 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.
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>>
> >>>>>>>>>
> >>>>
> >>>
> >>
> >>
> >
>
>
> --
> Alex Karasulu
> My Blog :: http://www.jroller.com/akarasulu/
> Apache Directory Server :: http://directory.apache.org
> Apache MINA :: http://mina.apache.org
>

Re: classcast on ApacheDS

Posted by Alex Karasulu <ak...@gmail.com>.
Hi Mert, Yiannis,

Yiannis is right on this one.  We fixed a lot of bugs in 1.5.5 and I think
it may impact this scenario.  Give it a try and let us know.  1.5.5 should
be out here in a week or so.  We apologize for the delays.


2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>

> I go via the "build your own" route to be honest, just get the entire
> source tree via SVN and do a mvn -Dmaven.test.skip=true install
>
> Y.
>
>
> Mert Çalışkan wrote:
>
>> ok,
>> is there any nightly builds? or I should do it myself?
>>
>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>
>>
>>
>>> Sorry I meant build off of the SVN branch, this is what I am using.
>>>
>>>
>>> Mert Çalışkan wrote:
>>>
>>>
>>>
>>>> 1.5.5?
>>>> latest downloads are only for 1.5.4, no?
>>>> http://directory.apache.org/apacheds/1.5/downloads.html
>>>>
>>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Have you tried this with 1.5.5 ?
>>>>>
>>>>>
>>>>> Mert Çalışkan wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> yes, when that method executes, my ApacheDS server (standalone working
>>>>>> one)
>>>>>> throws that error.
>>>>>>
>>>>>>
>>>>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> 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 <
>>>>>>>> imavroukakis@gameaccount.com> 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.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>
>>>
>>
>>
>


-- 
Alex Karasulu
My Blog :: http://www.jroller.com/akarasulu/
Apache Directory Server :: http://directory.apache.org
Apache MINA :: http://mina.apache.org

Re: classcast on ApacheDS

Posted by Yiannis Mavroukakis <im...@gameaccount.com>.
I go via the "build your own" route to be honest, just get the entire 
source tree via SVN and do a mvn -Dmaven.test.skip=true install

Y.

Mert Çalışkan wrote:
> ok,
> is there any nightly builds? or I should do it myself?
>
> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>
>   
>> Sorry I meant build off of the SVN branch, this is what I am using.
>>
>>
>> Mert Çalışkan wrote:
>>
>>     
>>> 1.5.5?
>>> latest downloads are only for 1.5.4, no?
>>> http://directory.apache.org/apacheds/1.5/downloads.html
>>>
>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>
>>>
>>>
>>>       
>>>> Have you tried this with 1.5.5 ?
>>>>
>>>>
>>>> Mert Çalışkan wrote:
>>>>
>>>>
>>>>
>>>>         
>>>>> yes, when that method executes, my ApacheDS server (standalone working
>>>>> one)
>>>>> throws that error.
>>>>>
>>>>>
>>>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>>>> 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 <
>>>>>>> imavroukakis@gameaccount.com> 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.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>       
>
>   

Re: classcast on ApacheDS

Posted by Mert Çalışkan <mc...@gmail.com>.
ok,
is there any nightly builds? or I should do it myself?

2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>

> Sorry I meant build off of the SVN branch, this is what I am using.
>
>
> Mert Çalışkan wrote:
>
>> 1.5.5?
>> latest downloads are only for 1.5.4, no?
>> http://directory.apache.org/apacheds/1.5/downloads.html
>>
>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>
>>
>>
>>> Have you tried this with 1.5.5 ?
>>>
>>>
>>> Mert Çalışkan wrote:
>>>
>>>
>>>
>>>> yes, when that method executes, my ApacheDS server (standalone working
>>>> one)
>>>> throws that error.
>>>>
>>>>
>>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> 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 <
>>>>>> imavroukakis@gameaccount.com> 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.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>
>>>
>>
>>
>

Re: classcast on ApacheDS

Posted by Yiannis Mavroukakis <im...@gameaccount.com>.
Sorry I meant build off of the SVN branch, this is what I am using.

Mert Çalışkan wrote:
> 1.5.5?
> latest downloads are only for 1.5.4, no?
> http://directory.apache.org/apacheds/1.5/downloads.html
>
> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>
>   
>> Have you tried this with 1.5.5 ?
>>
>>
>> Mert Çalışkan wrote:
>>
>>     
>>> yes, when that method executes, my ApacheDS server (standalone working
>>> one)
>>> throws that error.
>>>
>>>
>>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>>
>>>
>>>
>>>       
>>>> 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 <
>>>>> imavroukakis@gameaccount.com> 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.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>       
>
>   

Re: classcast on ApacheDS

Posted by Mert Çalışkan <mc...@gmail.com>.
1.5.5?
latest downloads are only for 1.5.4, no?
http://directory.apache.org/apacheds/1.5/downloads.html

2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>

> Have you tried this with 1.5.5 ?
>
>
> Mert Çalışkan wrote:
>
>> yes, when that method executes, my ApacheDS server (standalone working
>> one)
>> throws that error.
>>
>>
>> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>>
>>
>>
>>> 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 <
>>>> imavroukakis@gameaccount.com> 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.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>>
>

Re: classcast on ApacheDS

Posted by Yiannis Mavroukakis <im...@gameaccount.com>.
Have you tried this with 1.5.5 ?

Mert Çalışkan wrote:
> yes, when that method executes, my ApacheDS server (standalone working one)
> throws that error.
>
>
> 2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>
>
>   
>> 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 <
>>> imavroukakis@gameaccount.com> 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.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>       
>
>   

Re: classcast on ApacheDS

Posted by Mert Çalışkan <mc...@gmail.com>.
yes, when that method executes, my ApacheDS server (standalone working one)
throws that error.


2009/4/22 Yiannis Mavroukakis <im...@gameaccount.com>

> 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 <
>> imavroukakis@gameaccount.com> 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.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>

Re: classcast on ApacheDS

Posted by Yiannis Mavroukakis <im...@gameaccount.com>.
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 <
> imavroukakis@gameaccount.com> 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.
>>>
>>>
>>>
>>>       
>
>   

Re: classcast on ApacheDS

Posted by Mert Çalışkan <mc...@gmail.com>.
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 <
imavroukakis@gameaccount.com> 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.
>>
>>
>>
>

Re: classcast on ApacheDS

Posted by Yiannis Mavroukakis <im...@gameaccount.com>.
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.
>
>