Error Saving Avatar

I seem to be receiving an error when saving avatars, using the following code:

VCard vCard = new VCard();

vCard.load(connection);

vCard.setAvatar(fileChooser.getSelectedFile().toURI().toURL());

vCard.save(connection);

It works fine the first time, when there was no previous avatar. But when trying to change the avatar, I get

No response from server on status set.:

at org.jivesoftware.smackx.packet.VCard.save(VCard.java:492)

The odd thing is the avatar does get saved, as other users on the roster can see the new avatar. Is this an error with the server? I’m using ejabberd.

Thanks in advance for any ideas.

Well I’ve tried Spark which doesn’t seem to have an issue setting the avatar with the server, so I’m assuming it’s something to do with my code. Can anyone help?

I think I’ve solved it. I noticed I do not get the error on small images, so it looks like I have to resize the images first.

Incidentally, in case anyone else is in the same situation, you can also set the packet reply timeout to a larger value in the SmackConfiguration class.