[ 
https://issues.apache.org/jira/browse/QPID-5673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13967098#comment-13967098
 ] 

Rob Godfrey commented on QPID-5673:
-----------------------------------

OK - this looks to be an issue in dealing with the host/virtual host ... 
Messenger is setting the hostname to "0.0.0.0", the Java Broker uses the 
hostname to lookup a virtual host to use... there is no VirtualHost "0.0.0.0" 
defined and thus it should generate an error... unfortunately the code 
{code}
        _vhost = _broker.getVirtualHostRegistry().getVirtualHost(host);
        _vhost.getConnectionRegistry().registerConnection(this);

        if(_vhost == null)
        {
            final Error err = new Error();
            err.setCondition(AmqpError.NOT_FOUND);
            err.setDescription("Unknown hostname " + _conn.getLocalHostname());
            _conn.close(err);
        }
{code}

has a stupid bug in it in that it attempts to register the connection with the 
virtual host before the null check on the vhost object...  moving the 
registration into an else after the if should solve the NPE... however 
Messenger and the Java Broker are still not going to get along very well unless 
there is a way to override what it is sending in host in the open frame.


> NPE during authentication when using Messenger API
> --------------------------------------------------
>
>                 Key: QPID-5673
>                 URL: https://issues.apache.org/jira/browse/QPID-5673
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: 0.29
>            Reporter: Justin Ross
>         Attachments: broker.out
>
>
> When I try to authenticate with an existing user (admin:admin), I get the 
> exception.  When I try to authenticate with a made-up user (test:test), I get 
> a "(null)" error response.
> Exception:
> {noformat}
> java.lang.NullPointerException
>       at 
> org.apache.qpid.server.protocol.v1_0.Connection_1_0.closeReceived(Connection_1_0.java:220)
>       at 
> org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint.receiveClose(ConnectionEndpoint.java:369)
>       at org.apache.qpid.amqp_1_0.type.transport.Close.invoke(Close.java:75)
>       at 
> org.apache.qpid.amqp_1_0.transport.ConnectionEndpoint.receive(ConnectionEndpoint.java:731)
>       at 
> org.apache.qpid.amqp_1_0.framing.FrameHandler.parse(FrameHandler.java:242)
>       at 
> org.apache.qpid.server.protocol.v1_0.ProtocolEngine_1_0_0_SASL$3.run(ProtocolEngine_1_0_0_SASL.java:367)
>       at 
> org.apache.qpid.server.protocol.v1_0.ProtocolEngine_1_0_0_SASL$3.run(ProtocolEngine_1_0_0_SASL.java:363)
>       at java.security.AccessController.doPrivileged(Native Method)
>       at javax.security.auth.Subject.doAs(Subject.java:356)
>       at 
> org.apache.qpid.server.protocol.v1_0.ProtocolEngine_1_0_0_SASL.received(ProtocolEngine_1_0_0_SASL.java:362)
>       at 
> org.apache.qpid.server.protocol.v1_0.ProtocolEngine_1_0_0_SASL.received(ProtocolEngine_1_0_0_SASL.java:64)
>       at 
> org.apache.qpid.server.protocol.MultiVersionProtocolEngine.received(MultiVersionProtocolEngine.java:132)
>       at 
> org.apache.qpid.server.protocol.MultiVersionProtocolEngine.received(MultiVersionProtocolEngine.java:48)
>       at 
> org.apache.qpid.transport.network.io.IoReceiver.run(IoReceiver.java:161)
>       at java.lang.Thread.run(Thread.java:744)
> {noformat}
> Test code:
> {noformat}
> from proton import Message, Messenger
> msgr = Messenger()
> msgr.start()
> try:
>     msg = Message()
>     msg.address = "amqp://admin:[email protected]:5672/test"
>     msg.body = "test"
>     msgr.put(msg)
>     msgr.send()
> finally:
>     msgr.stop()
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to