Glassfish-3.1.2.2
I have 1 Servlet and 2 EJB in my project.
Servlet--------->Init--------------->Print
// EJB init code
@Stateless
@RunAs("SYSTEM")
@DeclareRoles({"SYSTEM"})
public class Init {
@Resource
EJBContext ejb;
@EJB
private Print print;
public String initialize() {
System.out.println("**********" + ejb.getCallerPrincipal().getName());
System.out.println("**********" + ejb.isCallerInRole("SYSTEM"));
return print.printline();
}
}
// EJB Print code:
@Stateless
@DeclareRoles({"SYSTEM"})
public class Print {
@Resource
EJBContext ejb;
public void printline() {
System.out.println("**********" + ejb.getCallerPrincipal().getName());
System.out.println("*********" + ejb.isCallerInRole("SYSTEM"));
}
}
// Execution result:
INFO: **********ANONYMOUS (OK)
INFO: **********false (OK)
INFO: **********system (OK)
INFO: **********false (? )
Why Am I getting the second false (I am expecting true) ?
mapping of web project and ejb project
Thank you.