I am using Mojarra JSF implementation with Glassfish v3. Dont know really how to find out the mojarra version, but it's the one included with Glassfish.
I use container managed security and would like to secure a backing bean of my web application programmatically. In order to do so, I was following the Java EE Tutorial Vol1 on "VII -> 24 -> Securing an Enterprise Bean Programmatically".
Now, this doesnt seem very complicated for a quick start. When I try it however, the following error is displayed in browser:
"An error occurred performing resource injection on managed bean MyBean"
MyBean looks somewhat like this:
@ManagedBean
@RequestScoped
public class MyBean {
@Resource SessionContext ctx;
public String getUserId() {
Principal callerPrincipal = ctx.getCallerPrincipal();
return callerPrincipal.getName();
}
}
In the JSF Webapp after authenticated, I'd just like to do something like:
Welcome #{myBean.getUserId}
Anybody have an idea? Stacktrace has too many characters, if anybody likes to see I can post parts.
Thanks