Hi,
I am tryng 'How to Create a Java EE 6 Application with JSF 2, EJB 3.1, JPA, and NetBeans IDE 6.8' from
http://netbeans.dzone.com/articles/develop-java-ee-6-app-jsf2
and when I call the EJB 3.1 I get the following exception,
A system exception occurred during an invocation on EJB CustomerSessionBean method public java.util.List com.customerapp.ejb.CustomerSessionBean.retrieve()
javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB
This is the EJB declared in an EJB module,
@Stateless
@LocalBean
public class CustomerSessionBean {
@PersistenceContext
private EntityManager em;
public void persist(Object object) {
em.persist(object);
}
public List<Customer> retrieve() {
Query query = em.createNamedQuery("Customer.findAll");
return query.getResultList();
}
.............................................
.............................................
}
I call the ejb from a ManagedBean in a web client. This is the code,
@ManagedBean(name = "customer")
@SessionScoped
public class CustomerMBean {
private CustomerSessionBean customerSessionBean;
private Customer customer;
/** Creates a new instance of CustomerMBean */
public CustomerMBean() {
try {
customerSessionBean = (CustomerSessionBean) new InitialContext().lookup("java:global/CustomerApp-web/CustomerSessionBean");
} catch (NamingException ex) {
Logger.getLogger(CustomerMBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
/**
* Returns list of customer objects to be displayed in the data table
* @return
*/
public List<Customer> getCustomers()
{
return customerSessionBean.retrieve();
}
............................................................
............................................................
}
What am I doing wrong?
Thanks in advance,
Jose
[Message sent by forum member 'josealvarezdelara' (dakhla.0563_at_hotmail.com)]
http://forums.java.net/jive/thread.jspa?messageID=382584