0 Replies Latest reply on Jan 6, 2004 7:56 AM by nsdeonia

    sessionContext.getCallerPrincipal() retuning unknown object.

    nsdeonia

      Hi,

      I am getting ClassCast Exception when I try to retrieve principal object by sessionContext.getCallerPrincipal() in a bean method which is called by another bean.
      If I print sessionContext.getCallerPrincipal().getClass it prints my principal class's name, but when I cast it to that class I get ClassCastException.

      I have checked it is not null.

      I am using
      <security-identity>
      <use-caller-identity />
      </security-identity>
      tags in ejb-jar.xml.

      I am using jboss 2.4.4 on a Windows 2000 box.

      This problem goes if I write
      MyPrincipal principal = new MyPrincipal(role, stringParam);
      org.jboss.security.SecurityAssociation.setPrincipal(principal);
      before calling the second bean, which is dirty and difficult to maintain.

      Has anyone seen this problem?

      thanks in advance for any help.

      regards
      Narinder.