[jboss-user] [EJB 3.0] - Mail injection with EJB3

jc7442 do-not-reply at jboss.com
Tue Sep 4 09:59:56 EDT 2007


I probably have misunderstood the @Resource annotation. I try to inject my mail session in a EJB3.

When I write ... Session is not injected

  | @Resource(mappedname="java:/Mail"  Session session;


If I write ... it works fine


  | @Resource SessionContext ctx;
  | public .... (){
  | ctx.lookup("java:/Mail")
  | }
  | 

I believed that this two syntax was equivalent. What did I miss ? 

Is it possible to inject the mail session ? I only find a solution in writting jboss.xml and ejb-jar.xml. But in that case, using injection is much more complex than the lookup.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4080905#4080905

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4080905



More information about the jboss-user mailing list