I have a normal java bean which is singleton with jms resource like this :
@Resource(lookup="jms/queueConnectionFactory")
private QueueConnectionFactory myQueueConnFactory;
@Resource(lookup="jms/myQueue")
private Queue myMessageQueue;
private Connection myConn;
private Session mySe开发者_JAVA技巧ssion;
private MessageProducer msgProducer;
private MapMessage myMsg;
@PersistenceContext(name="OrderServicePU")
EntityManager em;
private static MyProducer msgClientProducer;
I tried to inject it to servlet controller but resulted with null pointer exception where the queue and connection factory is not get initialized.
@Inject private MyProducer msgProducer;
I have beans.xml and glassfish-resources.xml defined.
What wrong with that ?
The problem solved by properly configure the JMS resource.
精彩评论