2 Replies Latest reply: Mar 26, 2010 9:04 AM by 843793 RSS

    @Resource - NullPointerException

    843793
      Hi ,
      I am trying to lookup the Connection factory resource but I get a NullPointerException.I 'm running on JDK 6.0.

      Any ideas ?
      Do I need a deployment descriptor ?
      import javax.annotation.Resource;
      import javax.jms.QueueConnection;
      import javax.jms.QueueConnectionFactory;
      
      public class QueueSender {
      
           @Resource(mappedName="test-cf")
           static QueueConnectionFactory qConnectionFactory;
           /**
            * @param args
            */
           public static void main(String[] args) throws Exception {
                QueueConnection queueConnection = qConnectionFactory.createQueueConnection();
           }
      
      }
        • 1. Re: @Resource - NullPointerException
          608410
          Do you think the stacktrace of the NullPointerException is there just to annoy everyone, or do you think it contains possibly useful information - if not to you, then at least to someone trying to help you?

          Anyway this forum is about writing tools to process annotations, not so much about specific applications of those tools - so really your post is off topic, but I understand how you could be confused. A lot of forum descriptions could do with a significant makeover - including this one.

          The [JMS forum|http://forums.sun.com/forum.jspa?forumID=29] is more likely to yield a useful response to your post. I suggest you repost there.

          Bruce
          • 2. Re: @Resource - NullPointerException
            843793
            Thanks Bruce ...
            Not many will reply like you ... atleast for the link that you have provided :-)