简体   繁体   中英

issue with JavaEE6+Glassfish3.1.2.2+EJB3.1

I get the error:

javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB

In my app I have the following code:

@Path("/nodos")
@Stateless
public class NodosRestController extends NodosControllerRestController{
@Context
protected HttpServletRequest request;

@Inject
Log log;

@EJB(beanName = "NodoManager")
private NodoManager nm;

@EJB(name="TareaDescargaEventos")
private TareaDescargaEventos tde;

@EJB(beanName="TareaTransferenciaHuellas")
private TareaTransferenciaHuellas tareaTransferenciaHuellas;

@Resource
UserTransaction transaccion;

public NodosRestController() {
}

@GET
@GsonDevRootName("nodo")
@Produces(MediaType.APPLICATION_JSON)
public List<Nodo> getAllNodos() throws Throwable {
    return nm.findAllNodos();
}
@PUT
@GsonDevRootName("nodo")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Nodo updateNodo(Nodo nodo) throws Throwable {
    transaccion.begin();
    nodo = nm.updateNodo(nodo);
    transaccion.commit();
    return nodo;
}
}

When I don't use 'extends' the program work but when I use it the program fail

The NodosControllerRestController class is here:

public abstract class NodosControllerRestController {
@Context
protected UriInfo context;
@Context
protected HttpServletRequest request;
@Context
protected HttpServletResponse response;

//more code
}

There are a number of possible reasons that the code you've shown might error out. The reason is likely coming from encountering conflict exceptions during Glassfish's injection of field or method dependencies. Just check your NodosControllerRestController for any inconsistencies. Analyzing your exception stacktrace further will help as well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM