[jboss-user] [Security & JAAS/JBoss] - getCallerPrincipal throws NullPointerException
sunnygrass
do-not-reply at jboss.com
Wed Jan 21 22:18:56 EST 2009
I'am new in JAAS, so I wrote a simple EJB 3 bean to see how it works.
@Stateless
| @Remote({IGetUserName.class})
| public class GetUserName implements IGetUserName
| {
| SessionContext sc;
|
| @Resource
| public void setSc(SessionContext sc)
| {
| this.sc = sc;
| }
|
| @Override
| public String getUserName()
| {
| if ( sc==null ) return "Context is null";
|
| Principal p = sc.getCallerPrincipal();
| if ( p==null ) return "principal is null";
|
| return p.getName();
| }
| }
|
But when I call previous bean NullPointerException was throwed.
The environment is : JBoss 5.0.0.GA, jboss was started with the configuration "default". No other changes to the jboss conf files.
Does any one have an idea? I have looked around for a long time, but still don't know how to resolve it.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4203838#4203838
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4203838
More information about the jboss-user
mailing list