avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <david.g...@hic.gov.au>
Subject Logkit: NullPointerException in JMSQueueTarget constructor
Date Wed, 27 Feb 2002 07:24:14 GMT

We are getting a NPE in the above class when attempting to instantiate the
class. What we think is causing the instantiation to fail is that the
Server (in this case Websphere) does not have authorization to access JMS
(actually MQ Series under that).

The failing code is in "openConnection()" which looks like this:
    protected synchronized void openConnection()
    {
        try
        {
            m_connection = m_factory.createQueueConnection();
            m_connection.start();

            m_session =
                m_connection.createQueueSession( false,
Session.AUTO_ACKNOWLEDGE);

            m_sender = m_session.createSender( m_queue );
        }
        catch( final Exception e )
        {
            getErrorHandler().error( "Error starting connection", e, null
);
        }
    }
I think that it fails in createQueueConnection(), the code catches the
exception runs getErrorHandler()  which then throws the NPE because the
error handler is not defined!


If you track through the code, the private variable ErrorHandler
m_errorHandler in AbstractTarget is never initialized.

I suspect the only way to resolve this sort of problem is to initialize the
field thus:

    private ErrorHandler m_errorHandler = new
org.apache.log.util.DefaultErrorHandler();

Has anyone else seen this problem?



****************************************************************
NOTICE - This message is intended only for the use of the 
addressee named above and may contain privileged and 
confidential information.  If you are not the intended recipient
of this message you are hereby notified that you must not 
disseminate, copy or take any action based upon it.  If you 
received this message in error please notify HIC immediately.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of HIC.
****************************************************************

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message