I integrated Leshan in my GAE application and I'm testing it using Wildfly8.
During my tests I faced problem with Json parsing.
13:09:07,567 ERROR [io.undertow.request] (default task-31) UT005023: Exception handling request to /api/clients/client1/1/0: java.lang.RuntimeException: Unable to invoke no-args constructor for class org.eclipse.leshan.json.JsonRootObject. Register an InstanceCreator with Gson for this type may fix this problem.
at com.google.gson.internal.ConstructorConstructor$12.construct(ConstructorConstructor.java:210) [gson-2.2.4.jar:]
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:162) [gson-2.2.4.jar:]
at com.google.gson.Gson.fromJson(Gson.java:803) [gson-2.2.4.jar:]
at com.google.gson.Gson.fromJson(Gson.java:768) [gson-2.2.4.jar:]
at com.google.gson.Gson.fromJson(Gson.java:717) [gson-2.2.4.jar:]
at com.google.gson.Gson.fromJson(Gson.java:689) [gson-2.2.4.jar:]
at org.eclipse.leshan.json.LwM2mJson.fromJsonLwM2m(LwM2mJson.java:38) [leshan-core.jar:]
at org.eclipse.leshan.core.node.codec.json.LwM2mNodeJsonDecoder.decode(LwM2mNodeJsonDecoder.java:59) [leshan-core.jar:]
at org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeDecoder.decode(DefaultLwM2mNodeDecoder.java:67) [leshan-core.jar:]
at org.eclipse.leshan.core.node.codec.DefaultLwM2mNodeDecoder.decode(DefaultLwM2mNodeDecoder.java:46) [leshan-core.jar:]
at org.eclipse.leshan.server.californium.impl.LwM2mResponseBuilder.decodeCoapResponse(LwM2mResponseBuilder.java:359) [leshan-server-cf.jar:]
at org.eclipse.leshan.server.californium.impl.LwM2mResponseBuilder.visit(LwM2mResponseBuilder.java:122) [leshan-server-cf.jar:]
at org.eclipse.leshan.core.request.ReadRequest.accept(ReadRequest.java:134) [leshan-core.jar:]
at org.eclipse.leshan.server.californium.impl.CaliforniumLwM2mRequestSender$1.buildResponse(CaliforniumLwM2mRequestSender.java:100) [leshan-server-cf.jar:]
at org.eclipse.leshan.server.californium.impl.SyncRequestObserver.onResponse(SyncRequestObserver.java:52) [leshan-server-cf.jar:]
at org.eclipse.californium.core.coap.Request.setResponse(Request.java:416) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.server.ServerMessageDeliverer.deliverResponse(ServerMessageDeliverer.java:169) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.CoapStack$StackTopAdapter.receiveResponse(CoapStack.java:195) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.AbstractLayer.receiveResponse(AbstractLayer.java:101) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.ObserveLayer.receiveResponse(ObserveLayer.java:146) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.AbstractLayer.receiveResponse(AbstractLayer.java:101) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.BlockwiseLayer.receiveResponse(BlockwiseLayer.java:322) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.AbstractLayer.receiveResponse(AbstractLayer.java:101) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.ReliabilityLayer.receiveResponse(ReliabilityLayer.java:265) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.AbstractLayer.receiveResponse(AbstractLayer.java:101) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.stack.CoapStack.receiveResponse(CoapStack.java:138) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.CoapEndpoint$InboxImpl.receiveMessage(CoapEndpoint.java:747) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.CoapEndpoint$InboxImpl.access$900(CoapEndpoint.java:647) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.CoapEndpoint$InboxImpl$1.run(CoapEndpoint.java:661) [californium-core-2.0.0-M1.jar:]
at org.eclipse.californium.core.network.CoapEndpoint$5.run(CoapEndpoint.java:819) [californium-core-2.0.0-M1.jar:]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_80]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_80]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [rt.jar:1.7.0_80]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [rt.jar:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_80]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]
Caused by: java.lang.UnsupportedOperationException: Cannot allocate class org.eclipse.leshan.json.JsonRootObject
at com.google.gson.internal.UnsafeAllocator$4.newInstance(UnsafeAllocator.java:100) [gson-2.2.4.jar:]
at com.google.gson.internal.ConstructorConstructor$12.construct(ConstructorConstructor.java:207) [gson-2.2.4.jar:]
... 36 more
I suppose that the error comes from the bad parsing of jsonString but I don't know why and to solve it.
Thanks a lot.