edit-icon download-icon

MQ error: "Cannot find name server"

Last Updated: Oct 16, 2018

In the event of incorrect onsaddr configuration, the following error will be returned in the log:

“Exception in thread “main” com.aliyun.openservices.ons.api.exception.ONSClientException: Cannot find name server. Please check your network connection.”

In this case, check the following items:

  1. Check if the deployment restriction is violated. For more information, see the Note in the “Create a topic” section of Quick start guide.

  2. Check the connection between the local environment and the access point.

    • If Topic is in the internet:

      Measures: ping onsaddr-internet.aliyun.com

      Normally it is resolved to

    • If Topic is in a production environment:

      Measures: ping onsaddr-internal.aliyun.com

      Normally it is resolved to For example, if the access point’s IP address cannot be resolved, add DNS on the local machine, after which, you can see:

      Code screenshot

    • You cannot set proxy for a message queue. If you are using the internet, you must add the following addresses (port 80 and 8080) to the whitelist when applying for the security policy:





  3. Try to obtain the name server’s metadata information from the access point by using curl.

If the problem persists, please open a ticket.

Thank you! We've received your feedback.