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
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);
before calling the second bean, which is dirty and difficult to maintain.
Has anyone seen this problem?
thanks in advance for any help.