When it comes to MDB, the RunAs role on MDB class is working right. However, when creating a custom MessageListener class, how do we allow this class to access secured EJB. I add @RunAs on this class, but it seems not to have any affect while the RunAs on my MDB class is fine. In my custom MessageListener,
I just simply new InitialContext().lookup("ConnectionFactory") and use this connection to subscribe the JMS topic. The data is coming and then invokes a secured EJB method and got rejected.