开发者

Java Bean CDI Null Pointer Exception

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜