JBoss Community

Problems with resource injection in EJBs

created by cedricceler in EJB3 Development - View the full discussion

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

Start a new discussion in EJB3 Development at Community