My web application crashes, when it reaches the constructor from my ProductsBean
.
I get this error: Can't instantiate class: beans.ProductsBean
This is my ProductsBean
:
@ManagedBean
@ViewScoped
public class ProductsBean implements Serializable {
private List<ProductBean> products;
@ManagedProperty(value = "#{applicationBean}")
private ApplicationBean applicationBean;
private ProductBean selectedProduct;
public ProductsBean() {
Store store = applicationBean.getStore();
for (String c : store.getCategories()) {
for (Product p : store.getProductsOfCategory(c)) {
products.add(new ProductBean(p.getProduct_id(), p.getDescription(), p.getPrice(), p.getCategoryName()));
}
}
What is the cause of this error?