You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Rob Godfrey (JIRA)" <ji...@apache.org> on 2016/11/14 08:47:59 UTC

[jira] [Commented] (QPID-7510) error :"Unknown hostname in connection" when connect to qpid docker image made with qpid for java using AMQP 1.0

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

Rob Godfrey commented on QPID-7510:
-----------------------------------

So I don't believe this to be a bug - simply that you have not configured your broker to understand the mapping of ip-address/port by which it is externally visible.

The Qpid Broker for Java allows the concept of "virtual hosts", such that many distinct AMQP containers may be running within the same JVM.  In AMQP 1.0, when a connection is established there is an "open" command that comes down the wire from the client to the broker, in which the "host" that the connection wishes to establish itself to is provided.  The broker uses a concept of "virtual host aliases" to map the name provided in the open command to the virtual hosts it provides.

In your case above, there are two approaches to resolving your issue: 

# you can configure your client to explicitly provide the name of the virtual host to which you wish to connect.  In the Qpid JMS client this is done using the amqp.vhost option in the configuration URL (see: [https://qpid.apache.org/releases/qpid-jms-0.11.1/docs/index.html])
# you can configure your broker to match this IP address port (or, indeed all names if you prefer) to a virtual host of your choosing. In this case you will need to edit your config.json (you could also use the REST API to modify a running broker).  Inside your port definition you should see a section like this:
{code:javascript}
    "virtualhostaliases" : [ {
      "name" : "defaultAlias",
      "type" : "defaultAlias"
    }, {
      "name" : "hostnameAlias",
      "type" : "hostnameAlias"
    }, {
      "name" : "nameAlias",
      "type" : "nameAlias"
    } ]
{code}
This is the default configuration which establishes the following - the first entry defines the behaviour when the client provides no host - it aliases that behaviour to the virtual host node which has been marked as the "default".  The second "hostnameAlias" matches all hostnames that correspond to an IPAddress/port combination that the broker is aware of (that is it examines each of the addresses it knows it binds to, and uses that list).  Again unless a virtualHostNode is explicitly specified it will match these to the default virtual host.  The final entry here matches based on the name of the virtual host in the configuration.  You will want to add to this a pattern matching alias so that any request to connect to a host for the mapped port/address also matches.  The "simplest" change would simply be to  modify the above to be as follows:
{code:javascript}
    "virtualhostaliases" : [ {
      "name" : "defaultAlias",
      "type" : "defaultAlias"
    }, {
      "name" : "hostnameAlias",
      "type" : "hostnameAlias"
    }, {
      "name" : "nameAlias",
      "type" : "nameAlias"
    } , {
      "name" : "patternAlias",
      "type" : "patternMatchingAlias",
      "pattern" : "*"
    }  ]
{code}

This will simply match all provided host names to the default virtual host.  If you wanted you could modify the pattern to be more selective, or you could choose to make the virtual host it directs to explicit... but if you are only using one virtual host then there is probably no need.

> error :"Unknown hostname in connection" when connect to qpid docker image made with qpid for java  using AMQP 1.0
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: QPID-7510
>                 URL: https://issues.apache.org/jira/browse/QPID-7510
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Broker
>    Affects Versions: qpid-java-6.0.5
>         Environment: Docker version 1.12.3, build 6b644ec
> jdk1.7.0_79
>            Reporter: wuxinyu
>             Fix For: qpid-java-6.0.5
>
>
> Now,we wok with qpid docker image,made with qpid-java-6.0.5. An  error occurred,when  JMS based client that uses the AMQP v1.0 protocol connected to. 
> qpid  image dockerfile expose 5672, and use -P flag for port mapping
> the detail error :
> org.apache.qpid.jms.JmsResourceNotFoundException: Unknown hostname in connection open: '10.46.181.220' [condition = amqp:not-found]
> 	at org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:132)
> 	at org.apache.qpid.jms.provider.amqp.AmqpSupport.convertToException(AmqpSupport.java:103)
> 	at org.apache.qpid.jms.provider.amqp.AmqpAbstractResource.remotelyClosed(AmqpAbstractResource.java:147)
> 	at org.apache.qpid.jms.provider.amqp.AmqpAbstractResource.processRemoteClose(AmqpAbstractResource.java:240)
> 	at org.apache.qpid.jms.provider.amqp.AmqpProvider.processUpdates(AmqpProvider.java:772)
> 	at org.apache.qpid.jms.provider.amqp.AmqpProvider.access$1900(AmqpProvider.java:92)
> 	at org.apache.qpid.jms.provider.amqp.AmqpProvider$17.run(AmqpProvider.java:700)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at java.lang.Thread.run(Thread.java:745)
> Caught exception, exiting.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org