Skip to content

Issue with Dropwizard example #6

Closed
@med1985

Description

@med1985

For some reason I keep getting the exception below when trying to use JSOG with dropwizard:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "@ref"

I've tried to debug why and can't figure it out, I'll continue this weekend. It stops throwing exceptions when you set:

environment.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

But that obviously doesn't solve the problem. I tried it with the current dropwizard example Master (and v0.8.0) and made the following amendments:

(object with reference to itself)
@JsonIdentityInfo(generator=JSOGGenerator.class)
public class Person {
@id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;

@Column(name = "fullName", nullable = false)
private String fullName;

@Column(name = "jobTitle", nullable = false)
private String jobTitle;
@JoinColumn @OneToOne
private Person brother;

...

Then in the test:

@Test
public void testHelloWorld() throws Exception {
    Client client = ClientBuilder.newClient().register(new LoggingFilter(java.util.logging.Logger.getLogger("test"), true));
    WebTarget target = client.target("http://localhost:8080/people");

    Person person = new Person();
    person.setFullName("blah");
    Person brother = new Person();
    person.setFullName("brother");
    brother.setBrother(person);
    person.setBrother(brother);

    target.request().post(Entity.entity(person, MediaType.APPLICATION_JSON_TYPE));

}

You can see it's sending the correct JSOG-ed JSON object but if you set logging to debug you can see the exception I'm talking about.

Let me know if you want me to send you a zip of the files or anything.

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