0 Replies Latest reply on Jun 19, 2002 11:24 AM by cdemyanovich

    Failed lookup of Queue/TopicConnectionFactory causes NullPoi

    cdemyanovich

      I have written a JUnit TestCase that contains the following method.

      /**
      * Test that we can send a message to the processor.
      */
      public void testSendMessageToProcessor() throws NamingException, JMSException
      {
      Context ctx = new InitialContext();
      TopicConnectionFactory factory = (TopicConnectionFactory) ctx.lookup("TopicConnectionFactory");
      * TopicConnection connection = factory.createTopicConnection();
      TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic) ctx.lookup("topic/testTopic");
      TopicPublisher publisher = session.createPublisher(topic);
      TextMessage message = session.createTextMessage();
      message.setText("This is only a test");
      publisher.publish(message);
      }

      I receive a NullPointerException, without an accompanying message, at the line indicated by the asterisk. I find it very odd that I don't receive a NamingException if there is a problem looking up the connection factory. I'm using JBoss 2.4.6, JDK 1.3.1_03, Windows XP Professional (my development machine). I've tried the following, each without success:

      - Rework the code for Queues
      - Use "ConnectionFactory" instead of one of the aliases to it
      - Catching exceptions in the method instead of throwing them to aid troubleshooting/gain more detail
      - Run on a colleague's similarly configured machine

      The only success that I've had is to regress to JBoss 2.4.4. I would greatly appreciate any ideas in solving this problem for 2.4.6. Upgrading to 3.0 is not an option for this iteration of the project.

      Thank you very much for your time,
      Craig Demyanovich