I have written the following test method in a JUnit 3.7 TestCase:

 

    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 sender = session.createPublisher(topic);

        TextMessage message = session.createTextMessage();

        message.setText("This is only a test");

        sender.publish(message);

        if(connection != null)

        {

            connection.close();

        }

    }

 

This method executed successfully on JBoss 2.4.4.  On JBoss 2.4.6, however, it fails with a NullPointerException at the line indicated by the arrow.  I have verified via JNDIView that TopicConnectionFactory is available; I have also verified that topic/testTopic is available, should the method execute beyond where it has thus far.  I would greatly appreciate any help, as neither I nor my colleagues have been able to spot any flaws in the code or the configuration.  I'm running J2SDK 1.3.1_03 on Windows XP Pro.

 

Thank you very much for your time.

 

 

Reply via email to