In a @RequestScoped bean, I need another bean that is @ViewScoped.
So I tried:
@ManagedBean
@RequestScoped
public class RequestBean
{
@ManagedProperty( value = "#{viewBean}" )
private ViewBean viewBean;
public void setViewBean(...){...}
public void doSomething(){
// ...
}
}
The method doSomething() is called by a buttonClick and performs some ImageStreaming (which is the reason for my Bean to be RequestScoped). The injection itself works fine in the first place, but as soon as doSomething() is being called, I get this exception:
com.sun.faces.mgbean.ManagedBeanCreationException: Could not determine property viewBean for managed bean requestBean
(Translated message, could be slightly different)
at com.sun.faces.mgbean.ManagedBeanBuilder$BakedBeanProperty.set(ManagedBeanBuilder.java:615)
...
Caused by: java.lang.NullPointerException
at com.sun.faces.mgbean.BeanManager$ScopeManager$ViewScopeHandler.getFromScope(BeanManager.java:563)
...
...which is pretty much the same when you forget to implement the setter method. What is wrong here?