1

I have written a bulk fetch IMAP command as suggested in this post.

It's working perfectly and fast when I am running it as JUnit or independently as a jar utility.

The moment I deploy it on JBoss, and start running as a quartz scheduler, the exception below starts to occur. I checked Dynatrace and I don't see any spike in CPU or memory.

Could someone please suggest me what parameters can be checked in JBoss which could be causing any limitation on buffer size or IMAP connection time. I checked if there is any conflicting Java mail jar but no luck.

java.lang.IndexOutOfBoundsException
    at java.io.BufferedInputStream.read(BufferedInputStream.java:327)
    at com.sun.mail.iap.ResponseInputStream.readResponse(ResponseInputStream.java:154)
    at com.sun.mail.iap.Response.<init>(Response.java:95)
    at com.sun.mail.imap.protocol.IMAPResponse.<init>(IMAPResponse.java:60)
    at com.sun.mail.imap.protocol.IMAPResponse.readResponse(IMAPResponse.java:134)
    at com.sun.mail.imap.protocol.IMAPProtocol.readResponse(IMAPProtocol.java:270)
    at com.sun.mail.iap.Protocol.command(Protocol.java:313)
    at com.macys.notification.handlers.impl.BCCArchiveHandler$CustomProtocolCommand.doCommand(BCCArchiveHandler.java:321)
    at com.sun.mail.imap.IMAPFolder.doProtocolCommand(IMAPFolder.java:2721)
    at com.sun.mail.imap.IMAPFolder.doCommand(IMAPFolder.java:2671)
Community
  • 1
  • 1
  • 1
    What version of JavaMail are you using? What does the [JavaMail debug output](http://www.oracle.com/technetwork/java/javamail/faq/index.html#debug) show? – Bill Shannon Apr 06 '16 at 06:24
  • Following @BillShannon's advice, you should also start your JBoss on debug mode in order to understand why the IOOBE is occurring. – António Ribeiro Apr 06 '16 at 09:04
  • java mail version 1.4.1 . I will get the debug logs for both java mail and jboss and get back if I don't find anything. Thanks for help! – user2979919 Apr 07 '16 at 00:23

1 Answers1

1

I finally got the solution. On jboss server, ssl debug logs were turned on. Once I removed -Djavax.net.debug=ssl,handshake -Djavax.net.debug=all, it got fixed.