You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by adie <ma...@mirailabs.com> on 2017/05/16 15:59:42 UTC

LoginService is cleared when second rest dsl service is added

Hello,
  I have a strange behavior with Camel 2.17 and camel-jetty9 (2.17.0
referencing jetty 9.2.15.v20160210). I am currently having following
service:



We have a basic auth and everything works as designed. 
Problem starts when we add second service, because we are getting " No
LoginService for
org.eclipse.jetty.security.authentication.BasicAuthenticator... in
org.eclipse.jetty.security.ConstraintSecurityHandler..."

This is happening because as soon as we get second .get/.post rest dsl will
stop and restart the security handler again while initializing second
service. There, on stop security handler will clear it's login service as it
is not a managed bean (at least in scope of Jetty, it is a Spring bean).

Best Regards,
  Marcin



--
View this message in context: http://camel.465427.n5.nabble.com/LoginService-is-cleared-when-second-rest-dsl-service-is-added-tp5799654.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: LoginService is cleared when second rest dsl service is added

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Can you tell more about how that quick-fix works and what you have
done to make it? Maybe there is something we can do in the camel-jetty
source code, and if so you are welcome to look at providing a fix as a
.patch or github PR

On Mon, May 29, 2017 at 6:05 PM, adie <ma...@mirailabs.com> wrote:
> Ok,
> quick fix for that was to use HashLoginService instead of custom class
> implementing LoginService. As HashLoginService extends AbstractLifeCycle it
> is not being sanitized on stop of security handler (when second service is
> added).
>
> adie
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/LoginService-is-cleared-when-second-rest-dsl-service-is-added-tp5799654p5801309.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: LoginService is cleared when second rest dsl service is added

Posted by adie <ma...@mirailabs.com>.
Ok, 
quick fix for that was to use HashLoginService instead of custom class
implementing LoginService. As HashLoginService extends AbstractLifeCycle it
is not being sanitized on stop of security handler (when second service is
added).

adie



--
View this message in context: http://camel.465427.n5.nabble.com/LoginService-is-cleared-when-second-rest-dsl-service-is-added-tp5799654p5801309.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: LoginService is cleared when second rest dsl service is added

Posted by adie <ma...@mirailabs.com>.
For Camel 2.19 and Jetty 9.3.14.v20161028 stack trace is bit different but
error is the same (I will try to prepare an example later):




--
View this message in context: http://camel.465427.n5.nabble.com/LoginService-is-cleared-when-second-rest-dsl-service-is-added-tp5799654p5800810.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: LoginService is cleared when second rest dsl service is added

Posted by adie <ma...@mirailabs.com>.
Hi Claus,
  Many thanks for the response. For 2.17.6 the behavior is the same. For
2.18 I need to fix some dependency errors, so I will try a bit later. Just
if you are interested, below is a full stack trace:
(Camel 2.17.0)




--
View this message in context: http://camel.465427.n5.nabble.com/LoginService-is-cleared-when-second-rest-dsl-service-is-added-tp5799654p5800788.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: LoginService is cleared when second rest dsl service is added

Posted by Claus Ibsen <cl...@gmail.com>.
Can you try with a newer Camel release, and the upcoming 2.17.7 release

On Tue, May 16, 2017 at 5:59 PM, adie <ma...@mirailabs.com> wrote:
> Hello,
>   I have a strange behavior with Camel 2.17 and camel-jetty9 (2.17.0
> referencing jetty 9.2.15.v20160210). I am currently having following
> service:
>
>
>
> We have a basic auth and everything works as designed.
> Problem starts when we add second service, because we are getting " No
> LoginService for
> org.eclipse.jetty.security.authentication.BasicAuthenticator... in
> org.eclipse.jetty.security.ConstraintSecurityHandler..."
>
> This is happening because as soon as we get second .get/.post rest dsl will
> stop and restart the security handler again while initializing second
> service. There, on stop security handler will clear it's login service as it
> is not a managed bean (at least in scope of Jetty, it is a Spring bean).
>
> Best Regards,
>   Marcin
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/LoginService-is-cleared-when-second-rest-dsl-service-is-added-tp5799654.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2