1

I have one bean called LoadSelectItemsBean which is @ApplicationScoped and holds various select item lists which I want to be shared amongst all users of the system.

I would like this LoadSelectItemsBean bean to be a @ManagedProperty in two other beans. When I added the select item bean into another bean as a managed property it works fine (shown in following code snippet):

@RequestScoped
@ManagedBean
public class GeneralCarrierDataViewBean implements Serializable {

    private static final long serialVersionUID = 1L;
    @ManagedProperty(value = "#{loadSelectItemsBean}")
    private LoadSelectItemsBean selectItems;

However, when I try to add the select items bean as managed property in another bean, I start to experience problems. I use the same code in my AllianceViewBean:

@RequestScoped
@ManagedBean
public class AllianceViewBean implements Serializable {

    private static final long serialVersionUID = 1L;
    @ManagedProperty(value = "#{loadSelectItemsBean}")
    private LoadSelectItemsBean selectItems;

But when trying to load the application I receive the exception

com.sun.faces.mgbean.ManagedBeanPreProcessingException: Unexpected error processing managed property selectItems

My question is, can you declare one bean as a managed property in more than one other bean?

Thanks.

EDIT: My error has been solved, but I am still no closer to identifying why it could have originally occurred

LiamWilson94
  • 458
  • 2
  • 7
  • 26
  • I was pulling my hair out over why this wouldn't be conceptually possible to do within JSF. All I did was simply change the name of one of the managed properties to something different and the exception no longer occurs. Not sure why this was. Possibly my tomcat server referring to an old build. – LiamWilson94 Mar 18 '15 at 14:26
  • The answer is usually in the root cause of the exception. Next time you get an exception, scroll down to bottommost root cause in the stack trace and focus on it. – BalusC Mar 18 '15 at 14:51

0 Answers0