[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xmlblaster] Exception in the method I_Session.init
Hi Xavier,
I tried it out with our htpasswd plugin and I am able to reproduce the
error: it appears a timing problem: in some cases (when debugging for
instance) I get the correct USER_SECURITY_AUTHENTICATION exception but
in the normal case this is overshadowed by a communication exception
(which in your case leads to polling).
We will look at it in the next days and fix it.
Regards
Michele
Xavier Roques wrote:
> Hi Michele,
>
> Thanks for your very quick answer.
>
> The problem of throwing the error code USER_SECURITY_AUTHENTICATION is
> that the method
> I_XmlblasterAccess.connect never fails. The connection is well dead, but
> how the client will be
> able to know that the connection dies because the password is not the
> good one.
>
> By example, if I throw the error code USER_SECURITY_AUTHENTICATION the
> following code never catch
> an exception.
>
> try {
> I_XmlblasterAccess xbconnection = ...
>
> .....
>
> qos.setAddress (address);
> xbconnection.registerConnectionListener(this);
> xbconnection.setClientErrorHandler (new ClientHandlerError
> ());
> returnQos = xbconnection.connect(qos, this);
> ...
> } catch (XmlBlasterException e) {
> System.out.println ("Cannot connect due to the following error :" +
> e.getMessage());
> }
>
>
> If the server throws the error code USER_SECURITY_AUTHENTICATION during
> the initialization of the session,
> the line xbconnection.connect should throw an exception because the
> connection fails no ?
>
> But strangely the line xbconnection.connect(qos.this) successes and I'm
> informed that the connection dies thanks to the
> ConnectionStateListener.
>
> Is it a normal behavior ?
>
> Best regards,
>
> Xavier.
>
>> -----Original Message-----
>> From: owner-xmlblaster at server.xmlBlaster.org [mailto:owner-
>> xmlblaster at server.xmlBlaster.org] On Behalf Of Michele Laghi
>> Sent: mardi 4 septembre 2007 11:23
>> To: xmlblaster at server.xmlBlaster.org
>> Subject: Re: [xmlblaster] Exception in the method I_Session.init
>>
>> Hi Xavier,
>>
>> Xavier Roques wrote:
>>> Hi,
>>>
>>> I 'm using Xmlblaster 1.6
>>>
>>> I implemented my own class implementing the interface I_Session
>>>
>>> In the method
>>> public String init(I_SecurityQos securityQos) throws
> XmlBlasterException
>>> I throws the exception when the user cannot connect to the server
> (wrong
>>> password ...)
>>> new XmlBlasterException (this.global
>>> , ErrorCode.USER_ILLEGALARGUMENT
>>> , ""
>>> , e.getMessage());
>>>
>>> All works perfectly, but it does not work for one particular case:
>>> 1) The client is connected to the Server A in fail safe mode with
> a
>>> specified number of retries.
>>> 2) The server A is stopped and restarted with another database
>>> 3) the client tries to connect again to the Server A but cannot
>>> because the database has changed and the client does
>>> Not have anymore the rights to connect to the Server.
>>>
>>> Here the problem is that the connection of the client will never die
>>> even if the number of retries is exceeded.
>>>
>>> I fixed this problem by throwing the exception:
>>> throw new XmlBlasterException (this.global
>>> , ErrorCode.USER_SECURITY_AUTHENTICATION
>>> , ""
>>> , e.getMessage());
>>> In the method I_Session.init (I_SecurityQos securityQos).
>>>
>>> But with this exception, when the client invokes
>>> I_XmlBlasterAccess.connect it never throws an exception even if the
>>> password is not the good one :(
>>> The connection is dead OK but the client cannot know that the
> connection
>>> is refused because the password is the bad one.
>>>
>>> So my question is "What is the good exception to throw in the method
>>> I_Session.init."
>>>
>> As you did: the ErrorCode.USER_SECURITY_AUTHENTICATION is the correct
>> one to throw. On the client side a check is made against this
> exception
>> when the client library (the dispatcher) tries to reconnect: If this
>> exception is detected the connection goes to DEAD: if you have
>> registered a connection listener to your I_XmlBlasterAccess, the
> toDead
>> method of this listener should be invoked.
>>
>> Regards
>> Michele
>>
>>> Thanks in advance,
>>>
>>> Xavier.
>>>
>
>