Skip to content

Error: No content to map due to end-of-input #58

Open

Description

@ThefplAnalyst

Hi
I am able to connect and retrieve categories.
I am getting an error when trying to make a post.

final Post post = aPost().withTitle(aTitle().withRendered(expectedTitle).build()) .withExcerpt(anExcerpt().withRendered(expectedExcerpt).build()) .withContent(aContent().withRendered(expectedContent).build()) .withCategories(catogeryList) .build();

java.lang.RuntimeException: Can not create ParsedRestException.
Done
at com.afrozaar.wordpress.wpapi.v2.exception.ParsedRestException.of(ParsedRestException.java:105)
at com.afrozaar.wordpress.wpapi.v2.exception.PostCreateException.(PostCreateException.java:8)
at com.afrozaar.wordpress.wpapi.v2.Client.createPost(Client.java:156)
at com.afrozaar.wordpress.wpapi.v2.Client.createPost(Client.java:162)
at com.analyst.orchestrator.WebPublisher.main(WebPublisher.java:81)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
at [Source: [B@751e664e; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3781)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3721)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2819)
at com.afrozaar.wordpress.wpapi.v2.exception.ParsedRestException.of(ParsedRestException.java:98)

Activity

  1. johanmynhardt commented on Mar 10, 2020

    @johanmynhardt
    Contributor

    Hey @ThefplAnalyst :)

    Did you try to run this with debugging enabled? It appears that there was no response from the endpoint. It would be interesting to see what came across the wire.

  2. ThefplAnalyst commented on Mar 10, 2020

    @ThefplAnalyst
    Author

    Thanks johanmynhardt

    12:34:14.804 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Request Entity: <GET https://mywebsite.com?rest_route=/wp/v2/categories,{Authorization=[Basic cHJhdGhhcDpBY2NlbnR1cmU0ZXZlciE=], User-Agent=[wp-api-v2-client-java/4.8]}> log4j:WARN No appenders could be found for logger (org.springframework.web.client.RestTemplate). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 12:34:16.052 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Response Headers: 12:34:16.053 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Server -> [nginx] 12:34:16.053 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Date -> [Mon, 09 Mar 2020 17:34:19 GMT] 12:34:16.053 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Content-Type -> [application/json; charset=UTF-8] 12:34:16.053 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Transfer-Encoding -> [chunked] 12:34:16.053 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Connection -> [keep-alive] 12:34:16.053 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - X-Robots-Tag -> [noindex] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Link -> [<https://mywebsite.com/wp-json/>; rel="https://api.w.org/"] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - X-Content-Type-Options -> [nosniff] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Access-Control-Expose-Headers -> [X-WP-Total, X-WP-TotalPages] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Access-Control-Allow-Headers -> [Authorization, Content-Type] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - X-WP-Total -> [5] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - X-WP-TotalPages -> [1] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Allow -> [GET] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Vary -> [Origin,Accept-Encoding] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Set-Cookie -> [cxssh_status=off; expires=Wed, 17-Jun-2020 17:34:19 GMT; Max-Age=8640000; path=/] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Cache-Control -> [max-age=15552000] 12:34:16.054 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Expires -> [Sat, 05 Sep 2020 17:34:19 GMT] 12:34:16.055 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Host-Header -> [b7440e60b07ee7b8044761568fab26e8] 12:34:16.055 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - X-Proxy-Cache -> [MISS] 12:34:16.068 [main] DEBUG c.a.w.w.v.r.CustomRenderableParser - Parsing response for com.afrozaar.wordpress.wpapi.v2.model.Term[] 12:34:16.202 [main] DEBUG c.afrozaar.wordpress.wpapi.v2.Client - Request Entity: <POST https://fplhomepage.com?rest_route=/wp/v2/posts,{title=MyTitle, content=This is the sandbox, excerpt=This is the Exceprt, categories=[74], status=publish},{Authorization=[Basic cHJhdGhhcDpBY2NlbnR1cmU0ZXZlciE=], User-Agent=[wp-api-v2-client-java/4.8], Content-Type=[application/json]}> java.lang.RuntimeException: Can not create ParsedRestException. Done at com.afrozaar.wordpress.wpapi.v2.exception.ParsedRestException.of(ParsedRestException.java:105) at com.afrozaar.wordpress.wpapi.v2.exception.PostCreateException.<init>(PostCreateException.java:8) at com.afrozaar.wordpress.wpapi.v2.Client.createPost(Client.java:156) at com.afrozaar.wordpress.wpapi.v2.Client.createPost(Client.java:162) at com.analyst.orchestrator.WebPublisher.main(WebPublisher.java:81) Caused by: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input at [Source: [B@751e664e; line: 1, column: 1] at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148) at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3781) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3721) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2819) at com.afrozaar.wordpress.wpapi.v2.exception.ParsedRestException.of(ParsedRestException.java:98) ... 4 more

  3. johanmynhardt commented on Mar 10, 2020

    @johanmynhardt
    Contributor

    :-/ Hmm, I was hoping there would be actual content to see.

    Any possibility that you can recreate the request as a cURL request?
    Or if that doesn't return anything tangible, maybe even something from wireshark to show on a low level what's been processed?

    It hints at not getting anything from the server, which is awkward.

  4. neketsushonen commented on Jun 28, 2023

    @neketsushonen

    I got same exception

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions