Using @Reference(lookup="jmsConnectionFactory") annotation in glassfish


Trond Arild Lode Tobiassen Heidelberg
 

Hi. tried to use this feature, However injection does not happen and nullpointer results.
The test succeeds using jndi lookup directly, implying all is correct on glassfish for sending messages to MDB.

I have tried the Resource annotation on the field and also on the class. The class is defined as a Stateless Session bean. I have tried with fields as instance as well as static. I have tried with class annotation only and field annotation only.This is the code:

@Stateless(name = "jmsRunnabeStatelessSessionCDIBean", mappedName = "jmsRunnableStatelessSessionBeanCDIMappedName")
@LocalBean
@Resource(name = "jmsMyConnectionFactoryName", type = javax.jms.TopicConnectionFactory.class, mappedName = "jmsMyConnectionFactoryMappedName", lookup = "jmsMyConnectionFactory")
public class EmitterCDI implements Runnable {
 
@Resource(name = "jmsMyConnectionFactoryName", lookup = "jmsMyConnectionFactory")
private static TopicConnectionFactory connectionFactory;
.......
}

Hope one of you guys can shed some light as to why the nullpointer.

Best regards Trond 

Join glassfish@javaee.groups.io to automatically receive all group messages.