I'm wondering why ejb injection into JAX-RS resource (RestEasy on JBoss7) is not working. EJBs are not part of war but its own EJB jar but I supposed this should not be the problem. I'm forced to do the ctx.lookups "workaround", which are not pretty. Am I missing something or it is really not supported to inject EJB like that? Example below does not work with JBoss, but works with Glassfish (sadly I gotta run my application on JBoss)
Path("x")
@RequestScoped
public class UserResource {
@Inject // CDI not working too
private Service service1;
@EJB
private Service service2;
private Service service3;
@GET
@Path("y")
public Response authenticate(@Context HttpHeaders headers) {
System.out.println("null == " + service1);
System.out.println("null == " + service2);
service3 = annoyingLookup(Service.class);
System.out.println("null != " + service3);
}
private <T> T annoyingLookup(Class<T> clazz) {
...
ctx.lookup("java:app/module/" + classzz.getSimpleName());
}