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

Automation batch execution crashes if the "X-NXVoidOperation" header is not sent and the result of the operation is a Blob

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.7.1
    • Fix Version/s: 5.6.0-HF20, 5.7.2
    • Component/s: Automation
    • Upgrade notes:
      Hide

      Added ResponseHelper#getResponse(Object result, HttpServletRequest request)

      Show
      Added ResponseHelper#getResponse(Object result, HttpServletRequest request)

      Description

      For example, sending the following request:

      POST /site/automation/batch/execute
      Accept: application/json+nxentity, */*
      Content-Type: application/json+nxrequest; charset=UTF-8
      X-NXDocumentProperties: *
      

      with the following parameters:

      {"params":{"operationId":"Attach.Blob","batchId":"<my_batch_id>","document":"<my_doc_id>"},"context":{}}
      

      causes this error:

      2013-07-01 17:00:58,109 ERROR [com.sun.jersey.spi.container.ContainerResponse] A message body writer for Java class org.nuxeo.ecm.automation.core.collectors.BlobCollector, and Java type class org.nuxeo.ecm.automation.core.collectors.BlobCollector, and MIME media type application/json was not found
      2013-07-01 17:00:58,112 ERROR [com.sun.jersey.spi.container.ContainerResponse] The registered message body writers compatible with the MIME media type are:
      application/json ->
        org.nuxeo.ecm.platform.forms.layout.export.WidgetTypeDefinitionsJsonWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonAdapterWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonAutomationInfoWriter
        org.nuxeo.ecm.platform.forms.layout.export.WidgetTypeDefinitionJsonWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonDocumentWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonOperationWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonRecordSetWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonExceptionWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonTreeWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonDocumentListWriter
        org.nuxeo.ecm.automation.server.jaxrs.io.writers.JsonLoginInfoWriter
      */* ->
        com.sun.jersey.core.impl.provider.entity.FormProvider
        com.sun.jersey.core.impl.provider.entity.MimeMultipartProvider
        com.sun.jersey.core.impl.provider.entity.StringProvider
        com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
        com.sun.jersey.core.impl.provider.entity.FileProvider
        com.sun.jersey.core.impl.provider.entity.InputStreamProvider
        com.sun.jersey.core.impl.provider.entity.DataSourceProvider
        com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
        com.sun.jersey.core.impl.provider.entity.ReaderProvider
        com.sun.jersey.core.impl.provider.entity.DocumentProvider
        com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
        com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
        com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
        com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
        com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
      
      2013-07-01 17:00:58,113 ERROR [org.nuxeo.ecm.webengine.app.WebEngineExceptionMapper] Exception in JAX-RS processing
      javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class org.nuxeo.ecm.automation.core.collectors.BlobCollector, and Java type class org.nuxeo.ecm.automation.core.collectors.BlobCollector, and MIME media type application/json was not found
      	at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
      	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
      	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
      	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
      	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
      	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
      	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
      	at org.nuxeo.ecm.webengine.app.jersey.WebEngineServlet.containerService(WebEngineServlet.java:60)
      	at org.nuxeo.ecm.webengine.app.jersey.WebEngineServlet.service(WebEngineServlet.java:44)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.webengine.jaxrs.session.SessionCleanupFilter.run(SessionCleanupFilter.java:45)
      	at org.nuxeo.ecm.webengine.jaxrs.HttpFilter.doFilter(HttpFilter.java:43)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.webengine.app.WebEngineFilter.doFilter(WebEngineFilter.java:92)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.webengine.jaxrs.context.RequestContextFilter.run(RequestContextFilter.java:42)
      	at org.nuxeo.ecm.webengine.jaxrs.HttpFilter.doFilter(HttpFilter.java:43)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.wss.servlet.BaseWSSFilter.doFilter(BaseWSSFilter.java:137)
      	at org.nuxeo.wss.servlet.FailSafeWSSFilter.doFilter(FailSafeWSSFilter.java:55)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.platform.ui.web.rest.FancyURLFilter.doFilter(FancyURLFilter.java:129)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.platform.wi.filter.WIRequestFilter.doFilter(WIRequestFilter.java:114)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.platform.web.common.requestcontroller.filter.NuxeoRequestControllerFilter.doFilter(NuxeoRequestControllerFilter.java:145)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilterInternal(NuxeoAuthenticationFilter.java:595)
      	at org.nuxeo.ecm.platform.ui.web.auth.service.NuxeoAuthFilterChain.doFilter(NuxeoAuthFilterChain.java:35)
      	at org.nuxeo.ecm.platform.ui.web.auth.oauth.NuxeoOAuthFilter.doFilter(NuxeoOAuthFilter.java:119)
      	at org.nuxeo.ecm.platform.ui.web.auth.service.NuxeoAuthFilterChain.doFilter(NuxeoAuthFilterChain.java:33)
      	at org.nuxeo.ecm.platform.ui.web.auth.NuxeoAuthenticationFilter.doFilter(NuxeoAuthenticationFilter.java:391)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.platform.web.common.exceptionhandling.NuxeoExceptionFilter.doFilter(NuxeoExceptionFilter.java:79)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.nuxeo.ecm.platform.web.common.encoding.NuxeoEncodingFilter.doFilter(NuxeoEncodingFilter.java:59)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      	at org.nuxeo.runtime.tomcat.dev.DevValve.invoke(DevValve.java:70)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
      	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
      	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      	at java.lang.Thread.run(Thread.java:722)
      Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class org.nuxeo.ecm.automation.core.collectors.BlobCollector, and Java type class org.nuxeo.ecm.automation.core.collectors.BlobCollector, and MIME media type application/json was not found
      	... 60 more
      

      I think this happens because without the "X-NXVoidOperation": "true" header, the execute resource returns the result of the operation (BlobCollector in this case) whereas it is marked as @Produces("application/json").

        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 - 4 hours
                  4h