1 Reply Latest reply on Jan 4, 2012 2:26 PM by Guenther Bodlak

    Security Context at Startup-Time

    semubiz Newbie

      Hi everyone


      Is it somehow possible for Startup-Bean (@Startup on Singleton-EJB) annotation to have a security context set? Possibly run in anonymous mode?


      The Startup-Bean initially calls a Session Bean where I would like to access SessionContext.getCallerPrincipal(). That throws an exception: "java.lang.IllegalStateException: No security context established". I could program a workaround programmatically, but I would have to overload methods of several SessionBeans.


      Thank you

        • 1. Re: Security Context at Startup-Time
          Guenther Bodlak Newbie



          did you find an answer?


          I have a similar problem with a StartupServlet configured with run-as.


          public class TestServlet extends HttpServlet {


              private Principal principal;


              public void init(ServletConfig config) throws ServletException {

                  String caller = principal.getName(); // throws  java.lang.IllegalStateException: No security context established