Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.net.ConnectException Connection refused #1

Open
kamzata opened this issue Sep 3, 2014 · 20 comments
Open

java.net.ConnectException Connection refused #1

kamzata opened this issue Sep 3, 2014 · 20 comments
Assignees

Comments

@kamzata
Copy link

kamzata commented Sep 3, 2014

I run Zimbra on Ubuntu 12.04. Command is execute on the same Zimbra server


zimbra@myserver:/$ bashzimbashckup.sh -v

ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain1.tld/home/[email protected]/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /_zimbra, skipping

ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain2.tld/home/[email protected]/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /_zimbra, skipping

ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain3.tld/home/[email protected]/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /_zimbra, skipping

....


Further, I had to convert all ` with ' in the entire script.

@davromaniak
Copy link
Owner

Hi Kamzata.

Thanks for reporting the issue.

First, can you give some information on your zimbra setup (run 'zmcontrol -v' as the zimbra user) ?

Do you run the script directly from the zimbra server ?

Does "zmprov -l gaa" command launched as the zimbra user gives you anything ?

I don't understand why you need to change all by ' in the entire script, are used by bash to perform command substitution, so without `, the script won't work at all because they are used for the getopt part, which is very important.

Don't hesitate to provide as much information as you can. It will be easier for me to spot the problem here.

Thanks.

@davromaniak davromaniak self-assigned this Sep 3, 2014
@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

zimbra@myserver:/$ zmcontrol -v
Release 8.0.7.GA.6021.UBUNTU12.64 UBUNTU12_64 FOSS edition.

Yes, I run script directly on zimbra server.


zimbra@myserver:/$ zmprov -l gaa
[email protected]
[email protected]
.....

Yes, it output list of all email address


About substitution, if I leave ` and I run the script it return me an error like:

"Error in line 165... don't expect EOF"
"Error in line 166... don't expect EOF"

@davromaniak
Copy link
Owner

Ok.

I see the issue.

It only appears when the script is launched by the zimbra user. When launching as root, there's no issue.

The last commit (1ab5f7c) corrects this issue.

Thanks for reporting the issue and sorry for the inconvenience.

@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

Thank you for reply. No, even launching script by root nothing change, it show me same problems.

@davromaniak
Copy link
Owner

Ok, strange because the issue was on the part which is only run when the script is directly run using the zimbra user.

Can you confirm it's working now ?

Thanks.

@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

This is the output with the latest version you commit:

root@myserver:/# zimbashckup.sh -v
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
_ /_zimbra => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/_zimbra.tar
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain2.com/home/[email protected]/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /_zimbra, skipping
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
_ /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Inbox.tar
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
_ /Emailed Contacts => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Emailed Contacts.tar
_ /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Inbox.tar
_ /Sent => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Sent.tar
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
_ /Emailed Contacts => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Emailed Contacts.tar
_ /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Inbox.tar
_ /Sent => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Sent.tar
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
_ /Emailed Contacts => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Emailed Contacts.tar
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain4.com/home/[email protected]/Emailed%20Contacts?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /Emailed Contacts, skipping
_ /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Inbox.tar
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain4.com/home/[email protected]/Inbox?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /Inbox, skipping
_ /Sent => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Sent.tar
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain4.com/home/[email protected]/Sent?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /Sent, skipping
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
_ /Inbox => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/Inbox.tar
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain4.com/home/[email protected]/Inbox?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /Inbox, skipping
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
_ /_zimbra => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/_zimbra.tar
ERROR: zclient.IO_ERROR (Unable to get REST resource from http://mail.domain4.com/home/[email protected]/_zimbra?fmt=tar: Connection refused) (cause: java.net.ConnectException Connection refused)
ERROR : Unable to backup folder /_zimbra, skipping
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve
_ [email protected]
Nothing to backup here...
_ Mail filters (in sieve format) => /opt/zimbra/backup/mailbox/2014/09/03/[email protected]/filters.sieve

@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

I tried only backup function, I haven't tried restore backups yet

@davromaniak
Copy link
Owner

Hi again.

So now we don't have the bash error and I see more clearly the problem you have.

Apparently, you are running a multiple server configuration, and the issue is you can't reach the REST API on those servers (the error messages on Zimbra tools are quite wrong and "Connection refused" simply means zmmailbox cant reach the REST API).

As the zimbra user, list all servers with the command zmprov gas and try to use the ping command on them.

If the ping command is answering something like "ping: unknown host...", then try adding the ip and host combination to your /etc/hosts file and then try the following command : /opt/zimbra/bin/zmmailbox -z -m [email protected] getAllFolders

This is the kind of command used my the script, so if it's succeed, there's a big chance of the script succeeding.

By the way, I'm reopening this issue.

Thanks.

@davromaniak davromaniak reopened this Sep 3, 2014
@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

zimbra@myserver:/$ zmprov gas
mail.myserver.com
zimbra@myserver:/$ ping mail.myserver.com
PING mail.myserver.com (192.168.1.53) 56(84) bytes of data.
64 bytes from mail.myserver.com (192.168.1.53): icmp_req=1 ttl=64 time=0.017 ms
64 bytes from mail.myserver.com (192.168.1.53): icmp_req=2 ttl=64 time=0.039 ms
64 bytes from mail.myserver.com (192.168.1.53): icmp_req=3 ttl=64 time=0.042 ms

I have only one server on the same machines: mail.myserver.com

@davromaniak
Copy link
Owner

Ok, strange, because zmmailbox uses this value to find the REST API server to query to.

Could you try explicitely add the server to the last command I gave by adding "-h http://192.168.1.53" like /opt/zimbra/bin/zmmailbox -h http://192.168.1.53 -z -m [email protected] getAllFolders ?

If this works, maybe there's some misconfiguration on your zimbra instance.

Thanks.

@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

zimbra@myserver:/$ zmmailbox -u http://192.168.1.53 -z -m [email protected] getAllFolders
Id View Unread Msg Count Path


     1  unkn           0           0  /
    16  docu           0           0  /Briefcase
    10  appo           0           0  /Calendar
    14  mess           0           0  /Chats
     7  cont           0           0  /Contacts
     6  mess           0           0  /Drafts
    13  cont           0           0  /Emailed Contacts
     2  mess           0           3  /Inbox
     4  mess           0           0  /Junk
     5  mess           0           0  /Sent
    15  task           0           0  /Tasks
     3  unkn           0           0  /Trash

@davromaniak
Copy link
Owner

Ok, so when the URL is set, it works.

Could you run the following command : /opt/zimbra/bin/zmmailbox -d -z -m [email protected] getAllFolders ?

It will fail, but you will see some debug "SOAP RECEIVE" and "SOAP SEND", could you paste these parts ?

Thanks.

@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

zimbra@myserver:/$ zmmailbox -d -z -m [email protected]
========== SOAP SEND ==========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header




/soap:Header
soap:Body

zimbra
aWvirwtyw

/soap:Body

/soap:Envelope

======== SOAP RECEIVE =========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

/soap:Header
soap:Body

0_4b1b2986bcdca283a15a71cdf5d3f6f35dd9663a_69643d33363a65306661666438392d313336302d313164392d383636312d3030306139356439386566323b6578703d31333a313430393831353438313130323b61646d696e3d313a313b747970653d363a7a696d6272613b
43200000

/soap:Body
/soap:Envelope
=============================== (140 msecs)
========== SOAP SEND ==========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

0_4b1b2986bcdca283a15a71cdf5d3f6f35dd9663a_69643d33363a65306661666438392d313336302d313164392d383636312d3030306139356439386566323b6578703d31333a313430393831353438313130323b61646d696e3d313a313b747970653d363a7a696d6272613b



/soap:Header
soap:Body

[email protected]

/soap:Body

/soap:Envelope

======== SOAP RECEIVE =========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

/soap:Header
soap:Body

[email protected]
33e24081-8c91-49cb-98a7-868276af0c1a
mail.myserver.it

http://mail.myserver.it:80/service/soap/
https://mail.myserver.it:7071/service/admin/soap/
http://mail.domain4.com

/soap:Body
/soap:Envelope
=============================== (18 msecs)
========== SOAP SEND ==========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

0_4b1b2986bcdca283a15a71cdf5d3f6f35dd9663a_69643d33363a65306661666438392d313336302d313164392d383636312d3030306139356439386566323b6578703d31333a313430393831353438313130323b61646d696e3d313a313b747970653d363a7a696d6272613b



/soap:Header
soap:Body

[email protected]

/soap:Body

/soap:Envelope

======== SOAP RECEIVE =========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

/soap:Header
soap:Body

0_f26c86183f2ac47c01651a0e18237806a2324add_69643d33363a33336532343038312d386339312d343963622d393861372d3836383237366166306331613b6578703d31333a313430393835383638323938363b6169643d33363a65306661666438392d313336302d313164392d383636312d3030306139356439386566323b76763d313a323b747970653d363a7a696d6272613b
86400000

/soap:Body
/soap:Envelope
=============================== (5 msecs)
========== SOAP SEND ==========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

0_f26c86183f2ac47c01651a0e18237806a2324add_69643d33363a33336532343038312d386339312d343963622d393861372d3836383237366166306331613b6578703d31333a313430393835383638323938363b6169643d33363a65306661666438392d313336302d313164392d383636312d3030306139356439386566323b76763d313a323b747970653d363a7a696d6272613b

[email protected]


/soap:Header
soap:Body

/soap:Body

/soap:Envelope

======== SOAP RECEIVE =========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

174284

8.0.7_GA_6021 20140408123908 20140408-1242 FOSS

















/soap:Header
soap:Body

/soap:Body
/soap:Envelope
=============================== (64 msecs)
========== SOAP SEND ==========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

0_f26c86183f2ac47c01651a0e18237806a2324add_69643d33363a33336532343038312d386339312d343963622d393861372d3836383237366166306331613b6578703d31333a313430393835383638323938363b6169643d33363a65306661666438392d313336302d313164392d383636312d3030306139356439386566323b76763d313a323b747970653d363a7a696d6272613b


[email protected]


/soap:Header
soap:Body

/soap:Body

/soap:Envelope

======== SOAP RECEIVE =========
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
soap:Header

174284


/soap:Header
soap:Body

8.0.7_GA_6021 20140408123908 20140408-1242 FOSS
33e24081-8c91-49cb-98a7-868276af0c1a
[email protected]
75d852edb249a6d3103629e1de60b3fa
86399921
1
http://mail.domain4.com/home/[email protected]
8478
1404067710000
1404067710000
0


FALSE
FALSE
TRUE
TRUE
includeBody
TRUE
times new roman, new york, times, serif
html
it
FALSE
list
TRUE
-PT15M
TRUE
60m
TRUE
default
7d
dateDesc
FALSE
TRUE
FALSE
FALSE
TRUE
FALSE
FALSE
TRUE
8
TRUE
TRUE
FALSE
outlook
TRUE
1h
conversation
FALSE
TRUE
FALSE
25
FALSE
TRUE
FALSE
#000000
Europe/Berlin
right
FALSE
FALSE
FALSE
TRUE
FALSE
right
0
serenity
TRUE
TRUE
500ms
TRUE
FALSE
1:N:0800:1700,2:Y:0800:1700,3:Y:0800:1700,4:Y:0800:1700,5:Y:0800:1700,6:Y:0800:1700,7:N:0800:1700
right
TRUE
TRUE
FALSE
TRUE
TRUE
FALSE
TRUE
TRUE
FALSE
TRUE
30s
TRUE
TRUE
TRUE
FALSE
FALSE
5
25
TRUE
FALSE
10
delete
FALSE
FALSE
FALSE
TRUE
FALSE
next
dedupeNone
TRUE
workWeek
FALSE
0
ALL
>
TRUE
TRUE
FALSE
bottom
50
FALSE
0
TRUE
sent
TRUE
TRUE
TRUE
TRUE
0
FALSE
TRUE
12pt
advanced
FALSE
0
never
TRUE
12pt
TRUE
FALSE
25
includeBody
1
in:inbox
FALSE
TRUE
0
18
TRUE
TRUE
away
FALSE
briefcase
FALSE
public
TRUE


FALSE
TRUE
100
TRUE
!com_zimbra_email
!com_zimbra_url
!com_zimbra_date
+com_zimbra_webex
+com_zimbra_ymemoticons
+com_zimbra_srchhighlighter
+com_zimbra_phone
!com_zimbra_attachcontacts
!com_zimbra_attachmail
500
TRUE
TRUE
FALSE
TRUE
0
FALSE
TRUE
1m
FALSE
TRUE
TRUE
0
0
TRUE
4096
0
it
TRUE
TRUE
30d
FALSE
FALSE
TRUE
FALSE
90d
TRUE
TRUE
20
100
FALSE
TRUE
30d
0
10240000
TRUE
FALSE
FALSE
TRUE
TRUE
FALSE
FALSE
20
TRUE
FALSE
70
FALSE
1m
30d
0
20
FALSE
TRUE
TRUE
TRUE
0
0
TRUE
0
100
Facebook
LinkedIn
SocialCast
Twitter
100
TRUE
30d
test
TRUE
FALSE
100
TRUE
TRUE
FALSE
TRUE
33e24081-8c91-49cb-98a7-868276af0c1a
12h
TRUE
TRUE
TRUE
536870912
FALSE
FALSE
TRUE
10485760
0
TRUE
TRUE
64
1m
TRUE
FALSE
TRUE
TRUE
FALSE
TRUE
10000
TRUE
TRUE
TRUE
TRUE
10240
TRUE
TRUE
FALSE
FALSE
FALSE
0
TRUE
test test
TRUE
0
TRUE
20
10m
1m
2m
30m
5m
12h
FALSE
zimbra
FALSE
0m
TRUE
FALSE
example
FALSE
TRUE
FALSE
TRUE
TRUE
FALSE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
TRUE
10000
TRUE
TRUE
FALSE
TRUE
TRUE
FALSE
[email protected]
1m
TRUE
FALSE
TRUE
100
1
TRUE
TRUE
test test
6
TRUE




33e24081-8c91-49cb-98a7-868276af0c1a
>
TRUE
sent
test test
includeBody
same
outlook
DEFAULT
includeBody
20140625012448Z
[email protected]





http://mail.domain4.com/service/soap/
http://mail.domain4.com

/soap:Body
/soap:Envelope
=============================== (38 msecs)
mailbox: [email protected], size: 8.28 KB, messages: 3, unread: 0
authenticated as [email protected]
mbox [email protected]>

@davromaniak
Copy link
Owner

Here we are :).

Even though the XML markup was eaten by github, I can see some problems.

You see those 3 lines ? :
http://mail.forlini.it:80/service/soap/
https://mail.forlini.it:7071/service/admin/soap/
http://mail.domain4.com

Actually, those 3 lines should contain "mail.myserver.com" instead of "mail.forlini.it" and "mail.domain4.com".

I think you imported the Zimbra you have in production to a virtual machine to perform some tests, and it seems Zimbra kept some "old" configuration settings.

You have 2 ways to correct this :

  • Quick and Dirty : add an /etc/hosts entry for pointing mail.forlini.it and mail.domain4.com to 192.168.1.53
  • More clean way : Manually edit the Zimbra configuration files (I don't think you can change it through the Admin Console). I think the /opt/zimbra/conf/localconfig.xml file should contain all you need. But maybe you will have to edit some other files in /opt/zimbra/conf and restarting some services.

Thanks.

@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

Sorry, I forget to mask my server name so I edited previous post. I haven't imported but yes, I'm running Zimbra on a OpenVZ CT.

Anyway... Hit, my fault! I added entry "mail.domain4.com" on my /etc/hosts file just to try if it works and... it works!

Now I'm trying to do "more clean way" that you suggest.

Thank you

@kamzata
Copy link
Author

kamzata commented Sep 3, 2014

How restore backups works?

@davromaniak
Copy link
Owner

Hi.
For the restore process, it has to be performed with the zmmailbox tool (http://wiki.zimbra.com/wiki/Zmmailbox) with the postRestURL command.

Something like /opt/zimbra/bin/zmmailbox -z -m [email protected] -t 0 postRestURL “//?fmt=tgz&resolve=reset" account.tgz should work, but be
carefull (mostly with the resolve parameter, when set to "reset", it
will empty the destination mailbox and replace it with the TGZ dump. If
you can work with a test zimbra, don't hesitate to test it, I've done a
lot of mistakes when testing.

It's scheduled to include a restore functionnality in zimbashckup, but I haven't the time to write it.

But I will add a section in the README file about restoring backups.

Thanks.

@davromaniak
Copy link
Owner

I just added a section on the README file.

@kamzata
Copy link
Author

kamzata commented Sep 5, 2014

Great! I'll try to restore backups.

@muguiwara
Copy link

Hi,
I performed the steps above and get the following error:
zmmailbox z -m [email protected] getRestURL '/ ? fmt = tgz '> [email protected]
ERROR: zclient.IO_ERROR ( Unable to get REST resource from http://server1.domain.com/home/[email protected]/?fmt=tgz : Connection refused) (cause : java.net .ConnectException Connection refused)
Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants