ConnectionRefusedException while connecting to OMERO server


My Omero (5.5.1) server is running inside a VM. The Host is a Windows 10 machine. Logging in into the webclient works without any problem.

When I try to login via a python script (executed from the host) I got a ConnectionRefusedException. Running the same script inside the server the connection works fine.

The script:

import omero.clients
from omero.gateway import BlitzGateway
conn = BlitzGateway(USERNAME, PASSWORD, host=HOST, port=PORT)

The exception occures at the last line.

Traceback (most recent call last):
File “”, line 1, in
File “D:\temp\OmeroPy\\lib\python\omero\”, line 2194, in connect
File "D:\temp\OmeroPy\\lib\python\omero\gateway_init
.py", line 2054, in _createSession
File “D:\temp\OmeroPy\\lib\python\omero\”, line 631, in createSession
prx = rtr.createSession(username, password, ctx)
File “C:\Python27\lib\site-packages\”, line 258, in createSession
return _M_Glacier2.Router._op_createSession.invoke(self, ((userId, password), _ctx))
Ice.ConnectionRefusedException: Ice.ConnectionRefusedException:
Unknown error

Thanks for your help,



Here are some new information about the problem:
I checked the firewall and opened port. I think these settings are all fine.
The server is a CentOS Linux release 7.7.1908.

I tried to connect with the JSON-Api instead of the Python-Api.
Here “GET /api/” works as well as “GET /api/v0/servers/” and “GET /api/v0/token/”.
But “POST /api/v0/login/” did not work and the server answers with error 403.

Thanks for your help,

Hi @DanielJ,

am I right in assuming that OMERO.web is running the same VM with the OMERO.server? If so, let’s leave that out of our investigation for a moment.

Going back to:

this sounds to me very much like a firewall issue. Was there a wait before this exception was thrown? Also you said:

Which port or ports did you open? Have you tried the telnet test from e.g.

telnet server-name 4064


telnet server-name 4063


Hi Josh,

On the Windows-Host I opened port 4064 and 4063.
On the server ports 8080 (web access),4064 and 4063.

firewall-cmd --list-ports
gives me
8080/tcp 4063/tcp 4064/tcp

The output of
telnet server-name 4063

telnet server-name 4064
gives me an empty output

Temporary I disabled the firewall on Host-PC and Server but I run into the same error message.

Thanks, Daniel

Hi Daniel

Could you try the following inside your VM

  • Stop OMERO
  • Install netcat: yum install nmap-ncat
  • Run ncat -l 4064

From outside your VM on the host you’ve been using to test connectivity try and connect to port 4064 (e.g. using telnet) on the guest. You should see whatever you type on the test host printed out by netcat inside the VM. Note when you disconnect in telnet netcat will also exit so if you want to test again you’ll need to re-run ncat -l 4064. Please test 4063 too.


I had tested ncat on port 4064 and 4063. Both tests where successful.

I also successfully test the connection with the Java-Api. So Java-Api and the webclient works. Python-Api (ConnectionRefusedException) and JSON (error 403) didn’t work.

I also installed a new VM from scratch (install a fresh CentOS 7.7.1908 and a fresh Omero 5.5.1) and got the same results. I used the CentOS “minimum installation”. Mayby I need a package which is not included at the minimum installation?

Thanks for any help,

Just to confirm:

  • Java API and Python work inside the guest VM
  • Java API works from the host
  • Python doesn’t work from the host


Can you connect from Java and Python from an external machine?