wc-api-java
wc-api-java copied to clipboard
I've got the JsonParseException
Hello I think that the code has some issue I don't know why it doesn't work I followed the step in the instruction but it returned a JsonParseException ( I've tried the key with NodeJS library and it works normally )
Exception in thread "main" java.lang.RuntimeException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: (org.apache.http.conn.EofSensorInputStream); line: 1, column: 2]
at com.icoderman.woocommerce.DefaultHttpClient.getEntityAndReleaseConnection(DefaultHttpClient.java:129)
at com.icoderman.woocommerce.DefaultHttpClient.getAll(DefaultHttpClient.java:49)
at com.icoderman.woocommerce.WooCommerceAPI.getAll(WooCommerceAPI.java:44)
at com.mycompany.woocommerce_laoitdev.Main.main(Main.java:44)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: (org.apache.http.conn.EofSensorInputStream); line: 1, column: 2]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1804)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:663)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:561)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2624)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:826)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:723)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4129)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3988)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3058)
at com.icoderman.woocommerce.DefaultHttpClient.getEntityAndReleaseConnection(DefaultHttpClient.java:123)
... 3 more
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2.627s
Finished at: Fri Mar 30 10:35:42 ICT 2018
Final Memory: 8M/309M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project woocommerce_laoitdev: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Hi @frankxayachack this exception shows that jackson wasn't able to parse a response from your server. Try to identify what property/value causes this and post it here with more details (request, endpoint and so on). Thanks.