Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-3903

DSpace6 rest requests cannot return application/json (they can return application/xml)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 6.2
    • Fix Version/s: 6.3, 7.0
    • Component/s: REST API
    • Labels:
      None
    • Attachments:
      0
    • Comments:
      3
    • Documentation Status:
      Not Required

      Description

      Some recent code in the DSpace 6.3 snapshot has broken the json retrieval of objects from the legacy rest api.

      Andrew Bennet summarized this issue in Slack:

      Hi all - I'm seeing an issue when using the REST API on the 6_x branch of DSpace. When I make a request involving JSON, I get 500 errors. E.g. `curl http://localhost:8080/rest/collections -H "Accept: application/json"` returns a 500 error, whereas `curl http://localhost:8080/rest/collections -H "Accept: application/xml"` returns a 200 and the expected XML content. Would someone be able to verify whether this is reproducible? If it is, I can ticket it. I will attach the logged error below.
      When there is no `Accept` header it defaults to JSON and fails. This request works on previous releases of DSpace for me. (edited)

      Andrew Bennet [6:22 AM]
      added this Plain Text snippet: REST API error when requesting JSON
      SEVERE: Servlet.service() for servlet [DSpace REST API] in context with path [/rest] threw exception [javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value] with root cause
      java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value
      at com.fasterxml.jackson.databind.cfg.ConfigOverrides.<init>(ConfigOverrides.java:53)
      at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:564)
      at com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:480)

       

      <!DOCTYPE html>
      <html>
      <head>
      <title>Apache Tomcat/8.0.24 - Error report</title>
      <style type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}</style>
      </head>
      <body>
      <h1>HTTP Status 500 - javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value</h1>
      <div class="line"></div>
      <p>
      <b>type</b> Exception report
      </p>
      <p>
      <b>message</b>
      <u>javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value</u>
      </p>
      <p>
      <b>description</b>
      <u>The server encountered an internal error that prevented it from fulfilling this request.</u>
      </p>
      <p>
      <b>exception</b>
      </p>
      <pre>javax.servlet.ServletException: javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value
      org.dspace.utils.servlet.DSpaceWebappServletFilter.doFilter(DSpaceWebappServletFilter.java:85)
      </pre>
      <p>
      <b>root cause</b>
      </p>
      <pre>javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value
      org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:487)
      org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
      org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
      org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
      org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
      org.dspace.utils.servlet.DSpaceWebappServletFilter.doFilter(DSpaceWebappServletFilter.java:78)
      </pre>
      <p>
      <b>root cause</b>
      </p>
      <pre>org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value
      org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278)
      org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260)
      org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509)
      org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334)
      org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
      org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
      org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
      org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
      org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
      org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
      org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
      org.dspace.utils.servlet.DSpaceWebappServletFilter.doFilter(DSpaceWebappServletFilter.java:78)
      </pre>
      <p>
      <b>root cause</b>
      </p>
      <pre>java.lang.NoClassDefFoundError: Could not initialize class com.fasterxml.jackson.annotation.JsonInclude$Value
      com.fasterxml.jackson.databind.cfg.ConfigOverrides.<init>(ConfigOverrides.java:53)
      com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:564)
      com.fasterxml.jackson.databind.ObjectMapper.<init>(ObjectMapper.java:480)
      com.fasterxml.jackson.jaxrs.json.JsonMapperConfigurator.getDefaultMapper(JsonMapperConfigurator.java:44)
      com.fasterxml.jackson.jaxrs.base.ProviderBase.locateMapper(ProviderBase.java:866)
      com.fasterxml.jackson.jaxrs.base.ProviderBase.writeTo(ProviderBase.java:587)
      org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
      org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
      org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
      org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
      org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
      org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
      org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
      org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
      org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
      org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
      org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
      org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
      org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
      org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
      org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
      org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
      org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
      org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
      org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
      org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343)
      org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260)
      org.dspace.utils.servlet.DSpaceWebappServletFilter.doFilter(DSpaceWebappServletFilter.java:78)
      </pre>
      <p>
      <b>note</b>
      <u>The full stack trace of the root cause is available in the Apache Tomcat/8.0.24 logs.</u>
      </p>
      <hr class="line">
      <h3>Apache Tomcat/8.0.24</h3>
      </body>
      </html>

        Attachments

          Activity

            People

            Assignee:
            terrywbrady Terrence W Brady
            Reporter:
            terrywbrady Terrence W Brady
            Reviewer:
            Tim Donohue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: