tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: EJB Scheduler and @RunAs
Date Thu, 06 Jun 2013 11:05:55 GMT
Hmm, seems it is working so whats the issue you see?
Le 6 juin 2013 10:13, "hwaastad" <helge@waastad.org> a écrit :

> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message