Uploaded image for project: 'James Imap'
  1. James Imap
  2. IMAP-133

JPAStreamingMessage vs JPAMessage

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.1
    • Component/s: JPA Mailbox
    • Labels:
      None

      Description

      With newest James I quite often (as always not always) get this error during copy operations which causes them to fail:

      Exception in thread "pool-8-thread-1" java.lang.ClassCastException: org.apache.james.imap.jpa.mail.model.openjpa.JPAStreamingMessage cannot
      be cast to org.apache.james.imap.jpa.mail.model.JPAMessage
      at org.apache.james.imap.jpa.mail.model.JPAMailboxMembership.<init>(JPAMailboxMembership.java:64)
      at org.apache.james.imap.jpa.JPAMailbox.copyMessage(JPAMailbox.java:99)
      at org.apache.james.imap.jpa.openjpa.OpenJPAMailbox.copyMessage(OpenJPAMailbox.java:83)
      at org.apache.james.imap.store.StoreMailbox$5.run(StoreMailbox.java:611)
      at org.apache.james.imap.store.transaction.AbstractTransactionalMapper.execute(AbstractTransactionalMapper.java:38)
      at org.apache.james.imap.store.StoreMailbox.copy(StoreMailbox.java:603)
      at org.apache.james.imap.store.StoreMailbox.copyTo(StoreMailbox.java:637)
      at org.apache.james.imap.store.StoreMailboxManager.copyMessages(StoreMailboxManager.java:296)
      at org.apache.james.imap.processor.CopyProcessor.doProcess(CopyProcessor.java:82)
      at org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:125)
      at org.apache.james.imap.processor.AbstractMailboxProcessor.process(AbstractMailboxProcessor.java:80)
      at org.apache.james.imap.processor.AbstractMailboxProcessor.doProcess(AbstractMailboxProcessor.java:73)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:44)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.processor.base.AbstractChainedProcessor.process(AbstractChainedProcessor.java:46)
      at org.apache.james.imap.main.AbstractImapRequestHandler.doProcessRequest(AbstractImapRequestHandler.java:65)
      at org.apache.james.imap.main.ImapRequestStreamHandler.handleRequest(ImapRequestStreamHandler.java:82)
      at org.apache.james.imapserver.netty.ImapStreamChannelUpstreamHandler.processStreamIo(ImapStreamChannelUpstreamHandler.java:64)
      at org.jboss.netty.handler.stream.StreamHandler$1.run(StreamHandler.java:127)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

      streaming is set to false. I found the place where the JPAStreamingMessage is created:

      633 final MessageMapper<Id> mapper = createMessageMapper(session);
      634
      635 final List<MailboxMembership<Id>> originalRows = mapper.findInMailbox(set);

      in org.apache.james.imap.store.StoreMailbox. Those "originalRows" contain the JPAStreamingMessage(s). The question here is: How does the mapper know, which kind of Message to create - JPAStreamingMessage or JPAMessage? By the way, the former is defined twice in persistence.xml. First I thought, this might be the cause for the error, but really sometimes it gets the one type and after restarting James it maybe gets the other (but always the same type during one run).

        Attachments

          Activity

            People

            • Assignee:
              norman Norman Maurer
              Reporter:
              tcm Tim-Christian Mundt
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: