[Solved] openstack4j Startup Error: java.net.UnknownHostException: controller

When calling OpenStack using openstack4j connection, an error is reported
Specific part of the error reported:

Exception in thread "main" ConnectionException{message=RESTEASY004655: Unable to invoke request, status=0}
    at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.invoke(HttpExecutorServiceImpl.java:57)
    at org.openstack4j.connectors.resteasy.HttpExecutorServiceImpl.execute(HttpExecutorServiceImpl.java:31)
    at org.openstack4j.core.transport.internal.HttpExecutor.execute(HttpExecutor.java:51)
    at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:213)
    at org.openstack4j.openstack.internal.BaseOpenStackService$Invocation.execute(BaseOpenStackService.java:207)
    at
.............................
Caused by: java.net.UnknownHostException: controller
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
    at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
    at java.net.InetAddress.getAllByName(InetAddress.java:1192)
    at java.net.InetAddress.getAllByName(InetAddress.java:1126)

OpenStack environment: Through the OpenStack environment built on two virtual machines, the hostnames of the two virtual machines are controller, compute. and here the error is reported as unknown host.

Solution:
(1) Open windws/system32/driver/etc/hosts under Windows and add the following content

        Virtual Machine IP controller
        Virtual Machine IP compute

(2) Linux server

       vi  /etc/hosts

Read More: