I've tried to send a CoAP message to IN-CSE in OM2M but IN-CSE printed NullpointerException like the picture I've uploaded.
I solved the problem by modifying CoAPServer class in OM2M source code.
I think the problem is "to=coap://localhost/~/in-cse" so I modified requestPrimitive.setTo(request.getURI()) to request.Primivice.setTo(request.getOptions().getURIString()) in CoAPServer class.
I think this way is not good, I don't know how to solve the problem without modifying the code...
If anyone knows any other way, let me know.
Thanks
-- append
I found the solution to remove the error.
First, I checked the OM2M version released. and I tried to send CoAP message to old version(1.0.0). then It was transferred well without problem. but the latest version had an error. So I compared the two codes.( I focused on CoapServer.java in org.eclipse.om2m.binding.coap)
In Coapserver.java, service() create a requestPrimitive object and transfer to Router.java. and It puts the targetId as a "to" variable in the requestPrimitive object via setTargetId() (setTargetId() calls setTo()) in 1.0.0 version. but In the latest version, it puts the string returned getURI() as a "to" variable in the requestPrimitive object. (and in the latest version it does not seem to use targetId unless I use it.)
targetId contained "/in-cse" and getURI() returned "coap://localhost/~/in-cse".
The lastest version removed setTargetId() in reqeustPrimitive class. so when I modified setTo(getURI()) to setTo(targetId), it was transferred well.
Is this the bug of the lastest version? or am I doing something wrong?