4 Replies Latest reply on Nov 26, 2013 10:21 AM by Frank Cornelis

    No PolicyContextHandler for key=javax.servlet.http.HttpServletRequest

    Frank Cornelis Apprentice

      From within an EJB3 session bean (within an EAR with WAR entry point) I try to get the HttpSession object via JACC:

      private HttpSession getHttpSession() {
              HttpServletRequest httpServletRequest;
              try {
                  httpServletRequest = (HttpServletRequest) PolicyContext
                          .getContext("javax.servlet.http.HttpServletRequest");
              } catch (PolicyContextException e) {
                  throw new RuntimeException("JACC error: " + e.getMessage());
              }
              HttpSession httpSession = httpServletRequest.getSession();
              return httpSession;
          }
      

      This gives me the following exception:

      Caused by: java.lang.IllegalArgumentException: No PolicyContextHandler for key=javax.servlet.http.HttpServletRequest
          at javax.security.jacc.PolicyContext.getContext(PolicyContext.java:96) [jboss-jacc-api_1.5_spec-1.0.0.Beta1.jar:1.0.0.Beta1]
      

      This used to work on JBoss EAP 6.1