Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-22068

Convert adapter can't use CoreSession

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 8.10
    • Fix Version/s: None
    • Component/s: Convert, DAM, Rest API

      Description

      When DAM is installed and a URL like the following is used to convert a jpeg (or png or gif) file for pdf preview, an exception occurs.

      http://localhost:8080/nuxeo/api/v1/repo/default/id/fea463c9-f9eb-4eac-aecd-bddceb5f3528/@blob/blobholder:0/@convert?format=pdf
      

      Exception:

      org.nuxeo.ecm.core.api.NuxeoException: Cannot use a CoreSession outside a transaction
      	at org.nuxeo.ecm.core.api.local.LocalSession.getSession(LocalSession.java:104)
      	at org.nuxeo.ecm.core.api.AbstractSession.resolveReference(AbstractSession.java:336)
      	at org.nuxeo.ecm.core.api.AbstractSession.getDataModel(AbstractSession.java:1948)
      	at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.loadDataModel(DocumentModelImpl.java:448)
      	at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.getDataModel(DocumentModelImpl.java:458)
      	at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.getPart(DocumentModelImpl.java:1219)
      	at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.getProperty(DocumentModelImpl.java:1267)
      	at org.nuxeo.ecm.core.utils.BlobsExtractor.getBlobsProperties(BlobsExtractor.java:152)
      	at org.nuxeo.ecm.core.utils.BlobsExtractor.getBlobs(BlobsExtractor.java:130)
      	at org.nuxeo.ecm.core.api.blobholder.DocumentBlobHolder.getBlobs(DocumentBlobHolder.java:94)
      	at org.nuxeo.ecm.platform.picture.convert.ConvertToPDFPictureConverter.convert(ConvertToPDFPictureConverter.java:47)
      	at org.nuxeo.ecm.core.convert.service.ConversionServiceImpl.convert(ConversionServiceImpl.java:342)
      	at org.nuxeo.ecm.core.convert.service.ConversionServiceImpl.convertToMimeType(ConversionServiceImpl.java:406)
      	at org.nuxeo.ecm.restapi.server.jaxrs.adapters.ConvertAdapter.convertWithMimeType(ConvertAdapter.java:146)
      	at org.nuxeo.ecm.restapi.server.jaxrs.adapters.ConvertAdapter.convertWithFormat(ConvertAdapter.java:157)
      	at org.nuxeo.ecm.restapi.server.jaxrs.adapters.ConvertAdapter.convert(ConvertAdapter.java:83)
      

      The issue is that the ConvertAdapter stops the transaction to not hold it open while potentially long work is going on, unfortunately to get to the blobs we need to read un-loaded datamodels from the document so have to read them from the session which cannot be used outside a transaction.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 2 hours
                  1d 2h