Hi,
I have a question probably more in the line of implementation.

My simple webapp has an EJB jar dependency.
In the EJB there is a Scheduler:

@Singleton
@Startup
@DeclareRoles({"TestGroup"})
@RunAs("TestGroup")
public void TestTimerService(){

  @Inject
  @DBLog
  private Event<LogMessage> log;

  @Schedule(hour = "*", minute = "*",second = "*/10")
   public void processExpiredUsers() {
     log.fire(new LogMessage());
   }
}

@Stateless
@Asynchronous
@DeclareRoles({"AdminGroup", "TestGroup"})
public class LogListener {
   @Resource
    private SessionContext sessionContext;

   @PermitAll
    public void processDatabase(@Observes @DBLog LogMessage message) {
      System.out.println("Principal name: " +
sessionContext.getCallerPrincipal().getName());
    }
}

When the application is deployed,
the output is user guest (which probably is correct)

When I log into the web app (which also fires an @DBLog event) the output
changes to the loginuser,

Is this as its supposed to be?

BTW, I Still see the following in my logs:
WARNING: Injection data not found in JNDI context:
jndiName='comp/env/org.waastad.ejb.event.LogListener/sessionContext',
target=org.waastad.ejb.event.LogListener/sessionContex

- Always running 1.6.0-plus-SNAPSHOT - 



--
View this message in context: 
http://openejb.979440.n4.nabble.com/EJB-Scheduler-and-RunAs-tp4663519.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to