Mail fetching stops intermittently_IndexOutOfBoundsException

Mail fetching stops intermittently_IndexOutOfBoundsException

Error trace:

[com.adventnet.servicedesk.helpdesk.mail.task.MailFetchingTask]|[SEVERE]|[129]|: General Exception - Exception when trying to get messages. SO RETURNING...|java.lang.IndexOutOfBoundsException
at com.sun.mail.imap.IMAPFolder.checkRange(IMAPFolder.java:361)
at com.sun.mail.imap.IMAPFolder.getMessage(IMAPFolder.java:1251)
at javax.mail.Folder.getMessages(Folder.java:866)

Cause:

1. Servicedesk is trying to pull the mails from the mailbox as it has detected that there were some pending emails in the mailbox however, there seems to be another application that has fetched the mail before Servicedesk could fetch the mail.
2. Someone might have manually removed/moved such mails from the mailbox.

Solution:

1. Under Admin >> Mail Server Settings, Stop fetching and start again. 
2. eset the mailbox username/password and update the new credentials under Admin--> Mail Server Settings so that only Servicedesk can log in to this mailbox.

Note: Update the password both in incoming and outgoing settings and restart the application to fix this issue.

It is always recommended to use a dedicated mailbox for Servicedesk Plus MSP.