I have a problem grabbing "TaskController" from my application. Upon
logging into the web app and requesting the servlet that the following
code is running, I randomly get the proper output or a
NullPointerException. The exception occurs in the 5th line of code
listed below:
FacesContext fc = FacesContext.getCurrentInstance();
Application app = fc.getApplication();
ExpressionFactory expFactory = app.getExpressionFactory();
ValueExpression valExp =
expFactory.createValueExpression(fc.getELContext(), "#{taskController}",
TaskController.class);
TaskController tc = (TaskController) valExp.getValue(fc.getELContext());
tc is null after this, however if I request the link again and again,
I'll get proper output about once every five requests (the very first
request is always correct).
I've also tried the deprecated ValueBinding method however that results
in the same situation. Anyone have a suggestion on where to look for the
cause of this problem?
Thanks,
Mike Woods