Hi,
has anyone managed to bring those pieces together?
What I have running are some REST based Services with Jersey 1.18 but no EJB Injection seems to work.
@Path("/user") public class UserService { @EJB PDBInterface pdbBean; @POST @Produces("application/json") @Consumes("application/json") @Path("/json") public Response modifyJson(JsonBean input) { if (pdbBean != null) { input.setVal2(pdbBean.getUser("11")); } else { input.setVal2("pdb not injected"); } return Response.ok().entity(input).build(); } }
This service I can call but the Bean "pdbBean" is always null, so nothing gets injected.
I also tried to use the EJB directly as Rest Service class:
@Stateless @LocalBean @Path("/ejb") public class PDBInterface { @PersistenceContext EntityManager em; @GET @Path("/echo") @Produces("text/plain") public String getUser(String userId) { if (em != null) { return "em here"; } else { return "em not here"; } } }
Again no em is injected...
Anyone managed to get something like this running?
Frank