开发者

Java Bean CDI Null Pointer Exception

开发者 https://www.devze.com 2023-03-19 11:55 出处:网络
I have a normal java bean which is singleton with jms resource like this : @Resource(lookup=\"jms/queueConnectionFactory\")

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

精彩评论

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