I have tried all the solutions but I can´t fix this problem.
The classes that I have are:
- User (Entity)
- Negocio (Local interface EJB)
- NegocioImpl (Stateless EJB with PersistenceContext)
- Registro (Little
@ManagedBean
@RequestScoped
to insert Users in DB with@PostConstruct
init()
method and@Inject
attribute ofNegocio
and another attribute of User)
Here's the code of Registro:
import modelo.User;
import negocio.Negocio;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;
@ManagedBean
@RequestScoped
public class Registro {
@Inject
private Negocio negocio;
private User usuario;
@PostConstruct
public void init() {
usuario = new User();
}
public User getUsuario() {
return usuario;
}
public void setUsuario(User usuario) {
this.usuario = usuario;
}
public void insertarUsuario() {
negocio.sayHelloFromServiceBean(usuario);
}
public void saluda() {
negocio.hola();
}
}
Everything is apparently right. But when I test the application I have this exception:
Here is my web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
Here is my faces-config.xml file:
<?xml version='1.0' encoding='UTF-8'?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
</faces-config>
I'm using,
- JSF 2.0
- EJB 3.1
- JBoss 7.1.1 Final
- Java EE 6
with Intellij IDEA as IDE.
Thanks in advance