I’m testing the REST plugin for Openfire (latest version -> 1.3.9, tests with Postman) and when i try to create users through the API by sending a JSON document, I got an error 500 with the following stacktrace in the logs :
Caused by: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "users" (Class org.jivesoftware.openfire.plugin.rest.entity.UserEntity), not marked as ignorable
at [Source: HttpInputOverHTTP@68a3ecb3[c=467,q=0,[0]=null,s=STREAM]; line: 2, column: 15] (through reference chain: org.jivesoftware.openfire.plugin.rest.entity.UserEntity["users"])
at org.codehaus.jackson.map.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:53) ~[?:?]
at org.codehaus.jackson.map.deser.StdDeserializationContext.unknownFieldException(StdDeserializationContext.java:267) ~[?:?]
at org.codehaus.jackson.map.deser.std.StdDeserializer.reportUnknownProperty(StdDeserializer.java:649) ~[?:?]
at org.codehaus.jackson.map.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:635) ~[?:?]
at org.codehaus.jackson.map.deser.BeanDeserializer.handleUnknownProperty(BeanDeserializer.java:1355) ~[?:?]
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:717) ~[?:?]
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) ~[?:?]
at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2695) ~[?:?]
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1308) ~[?:?]
at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419) ~[?:?]
at com.sun.jersey.json.impl.provider.entity.JacksonProviderProxy.readFrom(JacksonProviderProxy.java:139) ~[?:?]
at com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:490) ~[?:?]
at com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123) ~[?:?]
at com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:86) ~[?:?]
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153) ~[?:?]
at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:203) ~[?:?]
at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) ~[?:?]
at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) ~[?:?]
at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) ~[?:?]
at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) ~[?:?]
at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) ~[?:?]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542) ~[?:?]
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) ~[?:?]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) ~[?:?]
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) ~[?:?]
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) ~[?:?]
... 46 more
The JSON payload :
{
"users": [
{
"username": "test",
"name": "testname",
"email": "test@test.com",
"password": "password",
"properties": [
{
"key": "testkey",
"value": "0"
}
]
},
{
"username": "test2",
"name": "test2 name",
"password": "password"
}
]
}
I also tried to create 1 user with the XML payload, and it worked correctly.
Any idea of the cause of this bug ?
Thank you