Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » [6.1.0.M5] Missing RunContext when calling Service from CredentialVerifier
icon5.gif  [6.1.0.M5] Missing RunContext when calling Service from CredentialVerifier [message #1757954] Wed, 22 March 2017 10:12 Go to next message
A N is currently offline A NFriend
Messages: 20
Registered: July 2014
Junior Member

in Version 6.1.0.M5 of Scout I am not able to call a service from my CredentialVerifier implementation in the same way I was able to in previous versions.

I was able to fix the issue by adding the following line in the verify method before calling the service:

RunContext.CURRENT.set(new RunContextProducer().produce(new Subject()));

Could someone please give me feedback on how to deal with this properly?




import org.eclipse.scout.rt.platform.BEANS;
import org.eclipse.scout.rt.platform.Bean;
import org.eclipse.scout.rt.platform.context.RunContext;
import org.eclipse.scout.rt.platform.context.RunContextProducer;


public class CredentialVerifier implements ICredentialVerifier {

  public int verify(String username, char[] password) throws IOException {

    if (BEANS.get(ICredentialVerificationService.class).login(username, password)) {
      return ICredentialVerifier.AUTH_OK;

    return ICredentialVerifier.AUTH_FAILED;


2017-03-22 10:56:12,400 WARN  [qtp348984985-18] org.eclipse.jetty.servlet.ServletHandler.doHandle( - /auth - MDC[]
java.lang.NullPointerException: null
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.tunnel(
	at org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.invokeService(
	at org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.invokeService(
	at org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnel.invokeService(
	at org.eclipse.scout.rt.shared.servicetunnel.ServiceTunnelProxyProducer.invoke(
	at org.eclipse.scout.rt.platform.interceptor.DecoratingProxy.invokeImpl(
	at org.eclipse.scout.rt.platform.interceptor.DecoratingProxy$P_InvocationHandler.invoke(
	at com.sun.proxy.$Proxy16.login(Unknown Source)
	at org.eclipse.scout.rt.server.commons.authentication.FormBasedAccessController.handleAuthRequest(
	at org.eclipse.scout.rt.server.commons.authentication.FormBasedAccessController.handle(
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
	at org.eclipse.jetty.servlet.ServletHandler.doScope(
	at org.eclipse.jetty.server.session.SessionHandler.doScope(
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
	at org.eclipse.jetty.server.Server.handle(
	at org.eclipse.jetty.server.HttpChannel.handle(
	at org.eclipse.jetty.server.HttpConnection.onFillable(
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
	at org.eclipse.jetty.util.thread.QueuedThreadPool$

[Updated on: Wed, 22 March 2017 10:13]

Report message to a moderator

Re: [6.1.0.M5] Missing RunContext when calling Service from CredentialVerifier [message #1758113 is a reply to message #1757954] Thu, 23 March 2017 16:44 Go to previous message
Paolo Bazzi is currently offline Paolo BazziFriend
Messages: 15
Registered: January 2017
Junior Member

This depends on the business logic within the ICredentialVerificationService implementation. If this service is a backend service, you need to call it within a run context.


        .withSubject( ... )
        .call(new Callable<Integer>() {
          public Integer call() throws Exception {
            if (BEANS.get(ICredentialVerificationService.class).login(username, password)) {
              return ICredentialVerifier.AUTH_OK;
          return ICredentialVerifier.AUTH_FAILED;

Note: Depending on the access check you want to perform in backend, you could use a fixed subject for such not authenticated calls to the backend:

    final Subject subject = new Subject();
    subject.getPrincipals().add(new SimplePrincipal("access-check-user"));
    return subject;


[Updated on: Thu, 23 March 2017 16:46]

Report message to a moderator

Previous Topic:How to integrate Eclipse Scout [Neon] with JasperReports
Next Topic:Offline Storage of Derby Database for Raspberry Pi
Goto Forum:

Current Time: Fri Nov 24 20:32:18 GMT 2017

Powered by FUDForum. Page generated in 0.02229 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software