Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-26036

Error retrieving message: [Ljava.lang.Object; cannot be cast to com.atlassian.confluence.content.CustomContentEntityObject

      After an upgrade to Confluence 4.2.3, Confluence failed to fetch mails if mail-user in Lotus Notes Domino is forbidden from deleting mails from the database. However, customer mentioned that it used to work before with the same setting in Confluence 4.1.7. Has there been any changes in the code?

      Sample stack trace for POP3 of Lotus Notes Domino mail server:

      ERROR [scheduler_Worker-3] [confluence.mail.archive.DefaultMailAccountManager] poll Error retrieving mail from POP3 account [telekom-eas@www.seitenbau.net:110] for space TCOMEAS: [Ljava.lang.Object; cannot be cast to com.atlassian.confluence.content.CustomContentEntityObject
      java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.atlassian.confluence.content.CustomContentEntityObject
      	at com.atlassian.confluence.mail.archive.content.DefaultMailContentManager.getMailItemFromSpace(DefaultMailContentManager.java:217)
      	at com.atlassian.confluence.mail.archive.content.DefaultMailContentManager.storeIncomingMail(DefaultMailContentManager.java:102)
      	at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.retrieveMessages(DefaultMailAccountManager.java:183)
      	at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.poll(DefaultMailAccountManager.java:128)
      	at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.poll(DefaultMailAccountManager.java:84)
      	at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.pollAllSpaces(DefaultMailAccountManager.java:284)
      	at com.atlassian.confluence.mail.archive.jobs.MailPollJob$1.doInTransaction(MailPollJob.java:35)
      	at com.atlassian.confluence.mail.archive.jobs.MailPollJob$1.doInTransaction(MailPollJob.java:31)
      	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.doInTransaction(HostContextTransactionTemplate.java:25)
      	at com.atlassian.sal.spring.component.SpringHostContextAccessor$1.doInTransaction(SpringHostContextAccessor.java:88)
      	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
      	at com.atlassian.sal.spring.component.SpringHostContextAccessor.doInTransaction(SpringHostContextAccessor.java:82)
      	at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistrar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.java:129)
      	at $Proxy249.doInTransaction(Unknown Source)
      	at sun.reflect.GeneratedMethodAccessor97.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$DynamicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:154)
      	at $Proxy249.doInTransaction(Unknown Source)
      	at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.execute(HostContextTransactionTemplate.java:21)
      	at sun.reflect.GeneratedMethodAccessor176.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
      	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
      	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
      	at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:39)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
      	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      	at $Proxy383.execute(Unknown Source)
      	at com.atlassian.confluence.mail.archive.jobs.MailPollJob.doExecute(MailPollJob.java:31)
      	at com.atlassian.quartz.jobs.AbstractJob.executeInternal(AbstractJob.java:86)
      	at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
      	at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
      	at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool$1.run(ConfluenceQuartzThreadPool.java:20)
      	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      

      This also affect IMAPS on Dovecot mail server with full permission of the mail-user (able to delete message).

      Sample stack trace from IMAPS of Dovecot mail server - different at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.retrieveMessages:

      2012-08-02 09:12:00,047 DEBUG [scheduler_Worker-1] [confluence.mail.archive.DefaultMailAccountManager] retrieveMessages There are 350 messages in the INBOX for Pop Account: mailplugin
      2012-08-02 09:12:00,059 ERROR [scheduler_Worker-1] [confluence.mail.archive.DefaultMailAccountManager] poll Error retrieving mail from IMAPS account [mailplugin@foo.bar.com:993] for space MA: [Ljava.lang.Object; cannot be cast to com.atlassian.confluence.content.CustomContentEntityObject
      java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to com.atlassian.confluence.content.CustomContentEntityObject
              at com.atlassian.confluence.mail.archive.content.DefaultMailContentManager.getMailItemFromSpace(DefaultMailContentManager.java:217)
              at com.atlassian.confluence.mail.archive.content.DefaultMailContentManager.storeIncomingMail(DefaultMailContentManager.java:102)
              at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.retrieveMessages(DefaultMailAccountManager.java:172)
              at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.poll(DefaultMailAccountManager.java:117)
              at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.poll(DefaultMailAccountManager.java:81)
              at com.atlassian.confluence.mail.archive.DefaultMailAccountManager.pollAllSpaces(DefaultMailAccountManager.java:273)
              at com.atlassian.confluence.mail.archive.jobs.MailPollJob.doExecute(MailPollJob.java:29)
              at com.atlassian.quartz.jobs.AbstractJob.executeInternal(AbstractJob.java:86)
              at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
              at org.quartz.core.JobRunShell.run(JobRunShell.java:199)
              at com.atlassian.confluence.schedule.quartz.ConfluenceQuartzThreadPool$1.run(ConfluenceQuartzThreadPool.java:20)
              at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)
      

            [CONFSERVER-26036] Error retrieving message: [Ljava.lang.Object; cannot be cast to com.atlassian.confluence.content.CustomContentEntityObject

            BillA added a comment -

            Thank you for raising this issue. While I can see how this feature would be useful, we have no plans to implement it in the foreseeable future. In order to set expectations, we're closing this request now. Thanks again for your idea.

            BillA added a comment - Thank you for raising this issue. While I can see how this feature would be useful, we have no plans to implement it in the foreseeable future. In order to set expectations, we're closing this request now. Thanks again for your idea.

            I'm having the same problem. This started when we moved from Confluence 3.5 to 4.3.7.

            The problem appears to be that the Confluence mail downloader can no longer tolerate duplicate messages. It apparently recognizes them, but barfs with the error message in the title of this page. The arduous workaround is to delete the first remaining message from the Unix POP server, redo "Fetch new mail" manually, delete the first remaining message, etc, etc...

            I'm connecting to Unix popper(1).

            Any hope of a fix?

            Ken Poulton added a comment - I'm having the same problem. This started when we moved from Confluence 3.5 to 4.3.7. The problem appears to be that the Confluence mail downloader can no longer tolerate duplicate messages. It apparently recognizes them, but barfs with the error message in the title of this page. The arduous workaround is to delete the first remaining message from the Unix POP server, redo "Fetch new mail" manually, delete the first remaining message, etc, etc... I'm connecting to Unix popper(1). Any hope of a fix?

            Nick Jensen added a comment - - edited

            I was having this problem in Confluence 5.1 attempting to import around 20 000 emails that I'd imported into an Exchange mailbox from PST archives.

            It turned out there were a relatively small number of corrupt email items. I was able to identify these by marking all items as unread, importing into the mailbox I'm connecting to via POP and then the Confluence import will stop and mark a particular email as read! It's working a treat after getting rid of the corrupted 70 or so items!

            Nick Jensen added a comment - - edited I was having this problem in Confluence 5.1 attempting to import around 20 000 emails that I'd imported into an Exchange mailbox from PST archives. It turned out there were a relatively small number of corrupt email items. I was able to identify these by marking all items as unread, importing into the mailbox I'm connecting to via POP and then the Confluence import will stop and mark a particular email as read! It's working a treat after getting rid of the corrupted 70 or so items!

            Problem still exists in confluence 5.1

            Marc Loosli added a comment - Problem still exists in confluence 5.1

            I had the same problem in Confluence 4.2.12, and made a fix.
            Please check the uploaded patch.

            This problem appears when confluence is checking if incoming mail is already registered in database. The cause of this problem seems the HQL, that is defined in FindInSpaceByMessageIdQueryFactory.java, used to query mail in space.

            Usually all incoming mails are new, and this HQL returns no corresponding objects.
            However, when incoming mails are duplicated for some reason, this HQL returns 'array of Objects' that is ContentProperties although the result should be a CustomContentEntityObject instance.

            We need to add 'Select content' at the beginning of the HQL to tell hibernate to return CustomContentEntityObject instance.

            This fix worked in our environment.

            Nagai Takayuki added a comment - I had the same problem in Confluence 4.2.12, and made a fix. Please check the uploaded patch. This problem appears when confluence is checking if incoming mail is already registered in database. The cause of this problem seems the HQL, that is defined in FindInSpaceByMessageIdQueryFactory.java, used to query mail in space. Usually all incoming mails are new, and this HQL returns no corresponding objects. However, when incoming mails are duplicated for some reason, this HQL returns 'array of Objects' that is ContentProperties although the result should be a CustomContentEntityObject instance. We need to add 'Select content' at the beginning of the HQL to tell hibernate to return CustomContentEntityObject instance. This fix worked in our environment.

            We could establish a workaround by using a POP3-Mail-account

            Martin Seibert added a comment - We could establish a workaround by using a POP3-Mail-account

            updated the stack trace

            Hanis Suhailah (Inactive) added a comment - updated the stack trace

            Don Willis added a comment -

            Yes, in Confluence 4.2 Mail Archiving became a bundled plug-in. Is there no stack-trace for this error?

            Don Willis added a comment - Yes, in Confluence 4.2 Mail Archiving became a bundled plug-in. Is there no stack-trace for this error?

              Unassigned Unassigned
              hsuhailah Hanis Suhailah (Inactive)
              Affected customers:
              16 This affects my team
              Watchers:
              24 Start watching this issue

                Created:
                Updated: