Copy an image from a page to a template will cause a ContentEntitySimulacrum issue with other macros.

XMLWordPrintable

    • 2
    • Severity 3 - Minor
    • 2

      Issue Summary

      Copy an image from a page to a template will cause a ContentEntitySimulacrum issue with other macros.

      Steps to Reproduce

      1. Create a page with Content by Label macro and with a single image.
      2. Create a new template in that space.
      3. Copy from original page Content by Label macro and the image.
      4. Preview template.

      Expected Results

      The page will display properly, with image and Content by Label macro.

      Actual Results

      Content by label macro will be broken, and this error will be visible:

      Error rendering macro 'contentbylabel'
      
      Unable to resolve entity name from Class [com.atlassian.confluence.core.ContentEntitySimulacrum] expected instance/subclass of [com.atlassian.confluence.core.ContentEntityObject]; nested exception is org.hibernate.HibernateException: Unable to resolve entity name from Class [com.atlassian.confluence.core.ContentEntitySimulacrum] expected instance/subclass of [com.atlassian.confluence.core.ContentEntityObject]
      

      The below exception is thrown in the atlassian-confluence.log file:

      2021-02-01 12:22:44,538 WARN [https-jsse-nio-8443-exec-137 url:/pages/rendercontent.action username:xxx] [xhtml.editor.embed.EditorEmbeddedImageResourceUnmarshaller] unmarshal Error unmarshaling editor embedded image
       -- referer: https://xxx/pages/templates2/createpagetemplate.action?key=~xxx | url: /pages/rendercontent.action | traceId: 040f809a0faa77a9 | userName: xxx | action: rendercontent
      org.springframework.orm.hibernate5.HibernateSystemException: Unable to resolve entity name from Class [com.atlassian.confluence.core.ContentEntitySimulacrum] expected instance/subclass of [com.atlassian.confluence.core.ContentEntityObject]; nested exception is org.hibernate.HibernateException: Unable to resolve entity name from Class [com.atlassian.confluence.core.ContentEntitySimulacrum] expected instance/subclass of [com.atlassian.confluence.core.ContentEntityObject]
      	at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:300)
      	at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:388)
      	at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:351)
      ...
      Caused by: org.hibernate.HibernateException: Unable to resolve entity name from Class [com.atlassian.confluence.core.ContentEntitySimulacrum] expected instance/subclass of [com.atlassian.confluence.core.ContentEntityObject]
      	at org.hibernate.tuple.entity.PojoEntityTuplizer.determineConcreteSubclassEntityName(PojoEntityTuplizer.java:312)
      	at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:4770)
      	at org.hibernate.internal.SessionImpl.getEntityPersister(SessionImpl.java:1636)
      	at org.hibernate.engine.internal.ForeignKeys.isTransient(ForeignKeys.java:225)
      	at org.hibernate.event.internal.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:499)
      ...
      

      Workaround

      Instead of copying the image, use the target URL of the image and attach it as a web image.

              Assignee:
              Unassigned
              Reporter:
              g (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: