[jboss-dev-forums] [EJB3 Development] - Problems with resource injection in EJBs

cedricceler do-not-reply at jboss.com
Thu May 10 08:36:43 EDT 2012


cedricceler [https://community.jboss.org/people/cedricceler] created the discussion

"Problems with resource injection in EJBs"

To view the discussion, visit: https://community.jboss.org/message/734750#734750

--------------------------------------------------------------
Hi guys,

Im having troubles to get my connection factory using annotation resource. 
It works well with the JNDI lookup but it does not with the annotation, my connection factory is null.

This is my code with the JNDI lookup (works) : 

ConnectionFactory factory = (ConnectionFactory)context.lookup("/ConnectionFactory");

This is my code with the annotation : 

  /** The connection factory. */
  @Resource(mappedName = "java:/ConnectionFactory")
  private ConnectionFactory factory;


I ve tried with different mappedName as : /ConnectionFactory, java:/JmsXA, JmsXA etc. but still nullpointerexception :-/.

If someone has an idea ...

Thx !
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/734750#734750]

Start a new discussion in EJB3 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2030]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120510/200f31a3/attachment.html 


More information about the jboss-dev-forums mailing list