|
From: henk de w. <hen...@ho...> - 2011-04-15 11:46:28
|
(sorry the previous version didn't looked too good in text, let's try again, sorry for the noise) Using JBoss AS 6, I have a JAX-RS resource that's also an EJB bean (also see http://community.jboss.org/message/599737). EJB injections work and the methods are correctly mapped to the declared URLs, but it seems that REST injections do not take place if RestEasy looks up the bean via JNDI. The following bean is defined in a separate EJB module, and it's JNDI name is declared via the resteasy.jndi.resources context param in web.xml of a web module: @Produces("application/xml")@Path("xxx")@Statelesspublic class TestResource { @Context private SecurityContext security; @EJB private SomeEJB someEJB; @GET @Path("bla") public User getTest() { return "<hi>hi!</hi>"; } } What happens is: * When invoking localhost:8080/myroot/xxx/bla, getTest() is correctly called. * someEJB has a correct stub reference * security remains null If I put a similar bean directly in the web module and omit the EJB annotations, the SecurityContext is correctly injected: @Produces("application/xml")@Path("yyy")public class TestWebResource { @Context private SecurityContext security; @GET @Path("bla") public User getTest() { return "<hi>hi!</hi>"; } } >From some old posts (e.g. http://stackoverflow.com/questions/1765766/jax-rs-interface-markup-and-context-injection) I learned this was a known problem in the past (2009), but would be fixed with the upcoming Java EE 6/JAX-RS integration. Am I doing something wrong or has this integration never been done for RestEASY? |