Ever encountered this error “[] INFO: I/O exception (java.net.ConnectException) caught when processing request: Connection refused
[] INFO: Retrying request
ERROR: zclient.IO_ERROR (invoke Connection refused, server: localhost) (cause: java.net.ConnectException Connection refused)” on Zimbra.

When you get this error, you can’t execute any Zimbra zmprov commands. This is devastating since daily Zimbra Admin users use Zimbra CLI a lot. In this guide, I’ll show you how to fix the “ERROR: zclient.IO_ERROR (invoke Connection refused, server: localhost) (cause: java.net.ConnectException Connection refused)” error.

What is Zimbra zmprov?

The zmprov tool performs all provisioning tasks in Zimbra LDAP, including creating accounts, aliases, domains, COS, distribution lists, and calendar resources. Each operation is invoked through command-line options, each of which has a long name and a short name.

What causes this error?

First, the main cause for this error is when Zimbra zmprov is not configured to get results from LDAP. To fix this, you need to set zimbra_zmprov_default_to_ldap to TRUE. This will make sure all the zmprov commands get replies from LDAP server.

How to fix it

Do a checking for the setting of zimbra_zmprov_default_to_ldap to be sure.

$ zmlocalconfig |grep zmprov
zimbra_zmprov_default_soap_server = localhost
zimbra_zmprov_default_to_ldap = false
zmprov_safeguarded_attrs = zimbraServiceEnabled,zimbraServiceInstalled
zmprov_tmp_directory = ${zimbra_tmp_directory}/zmprov

If set to false, reconfigure it to have the true flag. This will enable the setting.

$ zmlocalconfig -e zimbra_zmprov_default_to_ldap=true

Then recheck the settings:

$ zmlocalconfig |grep zmprov
zimbra_zmprov_default_soap_server = localhost
zimbra_zmprov_default_to_ldap = true
zmprov_safeguarded_attrs = zimbraServiceEnabled,zimbraServiceInstalled
zmprov_tmp_directory = ${zimbra_tmp_directory}/zmprov

Now try to execute any zmprov commands and see if it’s working fine.

$ zmprov gs `zmhostname` | grep zimbraServiceEnabled
zimbraServiceEnabled: amavis
zimbraServiceEnabled: antivirus
zimbraServiceEnabled: antispam
zimbraServiceEnabled: opendkim
zimbraServiceEnabled: stats
zimbraServiceEnabled: logger
zimbraServiceEnabled: proxy
zimbraServiceEnabled: service
zimbraServiceEnabled: zimbra
zimbraServiceEnabled: zimbraAdmin
zimbraServiceEnabled: zimlet
zimbraServiceEnabled: mailbox
zimbraServiceEnabled: spell
zimbraServiceEnabled: ldap
zimbraServiceEnabled: memcached
zimbraServiceEnabled: mta
zimbraServiceEnabled: snmp
zimbraServiceEnabled: dnscache

If this doesn’t solve your problem, try changing the zimbra_zmprov_default_soap_server to the IP address of your Mailbox server. Your setting will look like this.

$ zmlocalconfig -e zimbra_zmprov_default_soap_server=ip-address

Let me know if this doesn’t work for you. The other articles we have related to Zimbra include:

Zimbra Firewall Configuration with ufw for Ubuntu and firewalld for CentOS

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here