org.sonatype.nexus.repository.InvalidContentException: Declared content type application/xml, but discovered [text/plain, application/octet-stream].

Sonatype JIRA | Tamás Cservenák | 2 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    Valid POM is being requested, but Maven Proxy fails to validate it. The POM is not a valid XML but Maven would parse it. The POM in question: https://repository.sonatype.org/content/groups/sonatype-grid/org/json/org.json/2.0-NEXUS-3758/org.json-2.0-NEXUS-3758.pom Excerpt from logs: {noformat} 2015-05-20 13:37:40,119+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenFacetImpl - GET maven-central : /org/json/org.json/2.0-NEXUS-3758/org.json-2.0-NEXUS-3758.pom 2015-05-20 13:37:40,187+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenProxyFacet - Fetching: GET https://repo1.maven.org/maven2/org/json/org.json/2.0-NEXUS-3758/org.json-2.0-NEXUS-3758.pom HTTP/1.1 2015-05-20 13:37:40,187+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection request: [route: {s}->https://repo1.maven.org:443][total kept alive: 0; route allocated: 0 of 20; total allocated: 0 of 200] 2015-05-20 13:37:40,187+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection leased: [id: 5][route: {s}->https://repo1.maven.org:443][total kept alive: 0; route allocated: 1 of 20; total allocated: 1 of 200] 2015-05-20 13:37:40,362+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.httpclient.FilteredHttpClient - Remote status: Remote Available 2015-05-20 13:37:40,362+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenProxyFacet - Response: HttpResponseProxy{HTTP/1.1 404 Not Found [Server: nginx, Content-Type: text/html, Via: 1.1 varnish, Content-Length: 168, Accept-Ranges: bytes, Date: Wed, 20 May 2015 11:37:40 GMT, Via: 1.1 varnish, Age: 1051259, Connection: keep-alive, X-Served-By: cache-iad2128-IAD, cache-fra1246-FRA, X-Cache: HIT, HIT, X-Cache-Hits: 1, 1, X-Timer: S1432121860.473672,VS0,VE0] ResponseEntityProxy{[Content-Type: text/html,Content-Length: 168,Chunked: false]}} 2015-05-20 13:37:40,362+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenProxyFacet - Status: HTTP/1.1 404 Not Found 2015-05-20 13:37:40,362+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection [id: 5][route: {s}->https://repo1.maven.org:443] can be kept alive for 30.0 seconds 2015-05-20 13:37:40,362+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection released: [id: 5][route: {s}->https://repo1.maven.org:443][total kept alive: 1; route allocated: 1 of 20; total allocated: 1 of 200] 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Router - Response: Response{status=Status{successful=false, code=404, message='null'}} 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Router - Request: HttpRequestAdapter{action='GET', path='/org/json/org.json/2.0-NEXUS-3758/org.json-2.0-NEXUS-3758.pom', parameters={}, payload=HttpRequestPayloadAdapter{contentType='null', size=-1}} 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Context - Starting: Route{matcher=org.sonatype.nexus.repository.maven.internal.MavenArtifactMatcher@32bfaec3, handlers=[org.sonatype.nexus.repository.view.handlers.TimingHandler@6e0af325, org.sonatype.nexus.repository.security.SecurityHandler@3140e65d, org.sonatype.nexus.repository.negativecache.NegativeCacheHandler@3f98cd28, org.sonatype.nexus.repository.partial.PartialFetchHandler@523c4887, org.sonatype.nexus.repository.maven.internal.VersionPolicyHandler@7fe19a3f, org.sonatype.nexus.repository.maven.internal.MavenHeadersHandler@76b56b74, org.sonatype.nexus.repository.proxy.ProxyHandler@9d24977]} 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Context - Proceeding: org.sonatype.nexus.repository.view.handlers.TimingHandler@6e0af325 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Context - Proceeding: org.sonatype.nexus.repository.security.SecurityHandler@3140e65d 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Context - Proceeding: org.sonatype.nexus.repository.negativecache.NegativeCacheHandler@3f98cd28 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Context - Proceeding: org.sonatype.nexus.repository.partial.PartialFetchHandler@523c4887 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Context - Proceeding: org.sonatype.nexus.repository.maven.internal.VersionPolicyHandler@7fe19a3f 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Context - Proceeding: org.sonatype.nexus.repository.maven.internal.MavenHeadersHandler@76b56b74 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.view.Context - Proceeding: org.sonatype.nexus.repository.proxy.ProxyHandler@9d24977 2015-05-20 13:37:40,363+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenFacetImpl - GET rso : /org/json/org.json/2.0-NEXUS-3758/org.json-2.0-NEXUS-3758.pom 2015-05-20 13:37:40,365+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenProxyFacet - Fetching: GET https://repository.sonatype.org/content/repositories/sonatype-grid/org/json/org.json/2.0-NEXUS-3758/org.json-2.0-NEXUS-3758.pom HTTP/1.1 2015-05-20 13:37:40,365+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection request: [route: {s}->https://repository.sonatype.org:443][total kept alive: 1; route allocated: 0 of 20; total allocated: 1 of 200] 2015-05-20 13:37:40,365+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection leased: [id: 6][route: {s}->https://repository.sonatype.org:443][total kept alive: 1; route allocated: 1 of 20; total allocated: 2 of 200] 2015-05-20 13:37:41,209+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.httpclient.FilteredHttpClient - Remote status: Remote Available 2015-05-20 13:37:41,209+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenProxyFacet - Response: HttpResponseProxy{HTTP/1.1 200 OK [Server: nginx/0.8.54, Date: Wed, 20 May 2015 11:37:41 GMT, Content-Type: application/xml, Connection: keep-alive, Keep-Alive: timeout=5, X-Frame-Options: SAMEORIGIN, X-Content-Type-Options: nosniff, Accept-Ranges: bytes, ETag: "{SHA1{09e0ffa58a51ae5a0b344fd5ed2574502dabf617}}", Last-Modified: Mon, 18 Oct 2010 15:28:05 GMT, Content-Length: 1062] ResponseEntityProxy{[Content-Type: application/xml,Content-Length: 1062,Chunked: false]}} 2015-05-20 13:37:41,209+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenProxyFacet - Status: HTTP/1.1 200 OK 2015-05-20 13:37:41,209+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenProxyFacet - Entity: ResponseEntityProxy{[Content-Type: application/xml,Content-Length: 1062,Chunked: false]} 2015-05-20 13:37:41,210+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenFacetImpl - PUT rso : /org/json/org.json/2.0-NEXUS-3758/org.json-2.0-NEXUS-3758.pom 2015-05-20 13:37:41,212+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection [id: 6][route: {s}->https://repository.sonatype.org:443] can be kept alive for 5.0 seconds 2015-05-20 13:37:41,212+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.internal.httpclient.SharedHttpClientConnectionManager - Connection released: [id: 6][route: {s}->https://repository.sonatype.org:443][total kept alive: 2; route allocated: 1 of 20; total allocated: 2 of 200] 2015-05-20 13:37:41,213+0200 DEBUG [qtp1313331475-209] admin org.sonatype.nexus.repository.maven.internal.MavenFacetImpl - Discovered content type [text/plain, application/octet-stream] 2015-05-20 13:37:41,217+0200 WARN [qtp1313331475-209] admin org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Service failure org.sonatype.nexus.repository.InvalidContentException: Declared content type application/xml, but discovered [text/plain, application/octet-stream]. at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.determineContentType(MavenFacetImpl.java:522) [na:na] at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putAssetPayload(MavenFacetImpl.java:331) [na:na] at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putArtifact(MavenFacetImpl.java:295) [na:na] at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.put(MavenFacetImpl.java:249) [na:na] at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.put(MavenFacetImpl.java:237) [na:na] at org.sonatype.nexus.repository.maven.internal.MavenProxyFacet.store(MavenProxyFacet.java:54) [na:na] at org.sonatype.nexus.repository.proxy.ProxyFacetSupport.get(ProxyFacetSupport.java:157) [na:na] at org.sonatype.nexus.repository.proxy.ProxyHandler.handle(ProxyHandler.java:49) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.maven.internal.MavenHeadersHandler.handle(MavenHeadersHandler.java:46) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.maven.internal.VersionPolicyHandler.handle(VersionPolicyHandler.java:50) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.partial.PartialFetchHandler.handle(PartialFetchHandler.java:60) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.negativecache.NegativeCacheHandler.handle(NegativeCacheHandler.java:49) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:46) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:46) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.view.Context.start(Context.java:112) [na:na] at org.sonatype.nexus.repository.view.Router.dispatch(Router.java:58) [na:na] at org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:45) [na:na] at org.sonatype.nexus.repository.group.GroupHandler.getFirst(GroupHandler.java:119) [na:na] at org.sonatype.nexus.repository.group.GroupHandler.doGet(GroupHandler.java:97) [na:na] at org.sonatype.nexus.repository.group.GroupHandler.handle(GroupHandler.java:81) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.partial.PartialFetchHandler.handle(PartialFetchHandler.java:60) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:46) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:46) [na:na] at org.sonatype.nexus.repository.view.Context.proceed(Context.java:89) [na:na] at org.sonatype.nexus.repository.view.Context.start(Context.java:112) [na:na] {noformat}

    Sonatype JIRA | 2 years ago | Tamás Cservenák
    org.sonatype.nexus.repository.InvalidContentException: Declared content type application/xml, but discovered [text/plain, application/octet-stream].

    Root Cause Analysis

    1. org.sonatype.nexus.repository.InvalidContentException

      Declared content type application/xml, but discovered [text/plain, application/octet-stream].

      at org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.determineContentType()
    2. org.sonatype.nexus
      Context.start
      1. org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.determineContentType(MavenFacetImpl.java:522)[na:na]
      2. org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putAssetPayload(MavenFacetImpl.java:331)[na:na]
      3. org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.putArtifact(MavenFacetImpl.java:295)[na:na]
      4. org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.put(MavenFacetImpl.java:249)[na:na]
      5. org.sonatype.nexus.repository.maven.internal.MavenFacetImpl.put(MavenFacetImpl.java:237)[na:na]
      6. org.sonatype.nexus.repository.maven.internal.MavenProxyFacet.store(MavenProxyFacet.java:54)[na:na]
      7. org.sonatype.nexus.repository.proxy.ProxyFacetSupport.get(ProxyFacetSupport.java:157)[na:na]
      8. org.sonatype.nexus.repository.proxy.ProxyHandler.handle(ProxyHandler.java:49)[na:na]
      9. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      10. org.sonatype.nexus.repository.maven.internal.MavenHeadersHandler.handle(MavenHeadersHandler.java:46)[na:na]
      11. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      12. org.sonatype.nexus.repository.maven.internal.VersionPolicyHandler.handle(VersionPolicyHandler.java:50)[na:na]
      13. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      14. org.sonatype.nexus.repository.partial.PartialFetchHandler.handle(PartialFetchHandler.java:60)[na:na]
      15. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      16. org.sonatype.nexus.repository.negativecache.NegativeCacheHandler.handle(NegativeCacheHandler.java:49)[na:na]
      17. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      18. org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:46)[na:na]
      19. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      20. org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:46)[na:na]
      21. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      22. org.sonatype.nexus.repository.view.Context.start(Context.java:112)[na:na]
      23. org.sonatype.nexus.repository.view.Router.dispatch(Router.java:58)[na:na]
      24. org.sonatype.nexus.repository.view.ConfigurableViewFacet.dispatch(ConfigurableViewFacet.java:45)[na:na]
      25. org.sonatype.nexus.repository.group.GroupHandler.getFirst(GroupHandler.java:119)[na:na]
      26. org.sonatype.nexus.repository.group.GroupHandler.doGet(GroupHandler.java:97)[na:na]
      27. org.sonatype.nexus.repository.group.GroupHandler.handle(GroupHandler.java:81)[na:na]
      28. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      29. org.sonatype.nexus.repository.partial.PartialFetchHandler.handle(PartialFetchHandler.java:60)[na:na]
      30. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      31. org.sonatype.nexus.repository.security.SecurityHandler.handle(SecurityHandler.java:46)[na:na]
      32. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      33. org.sonatype.nexus.repository.view.handlers.TimingHandler.handle(TimingHandler.java:46)[na:na]
      34. org.sonatype.nexus.repository.view.Context.proceed(Context.java:89)[na:na]
      35. org.sonatype.nexus.repository.view.Context.start(Context.java:112)[na:na]
      35 frames