Skip to content

Write POJO to csv, error: Can not start an object, expecting field name #473

Discussion options

You must be logged in to vote

I am still confused why Jackson not show me the real underlying error cause.

I changed my code to following:

handler.streamRead(req, t -> {
        try {
	        log.info("writing {} {} ", t.getClass().getName(), reg.getMapper(locator).getEntityType().getName());
	        sw.write(t);
        } catch (Exception e) {
	        log.error("error when writing object to csv", e);
	        throw new RuntimeException(e.getMessage());           //  break the Iterator#forEache by thorw a RuntimeException
        }
});

then it show me the real error:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type `java.time.Instant` not supported by default

The problem is solv…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@AlwaysNoobCoder
Comment options

@AlwaysNoobCoder
Comment options

Answer selected by AlwaysNoobCoder
@cowtowncoder
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants