JBoss Community

Re: JBoss AS 7.1.1.Final custom login module for remoting and custom principal

created by Rick-Rainer Ludwig in JBoss AS 7 Development - View the full discussion

I have exactly the same issue with JBoss 7.1.1. For the ClassCastException itself, I do not have a solution, but I have a workaround which works until I have a clean and staight solution.


When retrieving the principal via



public SessionContext sessionContext;


Principal principal = sessionContext.getCallerPrincipal();


I check the name of the instantiated class via


principal.getClass().getName(). equals(MyExpectedPrincipalClass.class.getName())


to assure the correct implementation and to avoid later exceptions. Then I work with reflection to access fields and method via getMethod() and getField(). It works fine, but it is quite ugly. Does anyone have a better idea?

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community