Home » Eclipse Projects » OM2M » Router Internal Error when running tutorial application
Router Internal Error when running tutorial application [message #1750076] |
Thu, 15 December 2016 18:46 |
Yu-Hao Hsu Messages: 15 Registered: July 2016 |
Junior Member |
|
|
Hi,
I followed the tutorial: Develop oneM2M applications to create application to test REST API. I run the MySensor.java, MyActuator.java and then run the MyManager.java.
To my understanding, MyManager.java will subscribe mysensor/data and send notification to /in-cse/in-name/mymanager.
But when I run MyManager.java, I got the following error message:
Quote:
[INFO] - org.eclipse.om2m.core.notifier.Notifier
Sending notify request to: /in-cse/in-name/mymanager
[INFO] - org.eclipse.om2m.core.notifier.Notifier
Sending notify request...
[INFO] - org.eclipse.om2m.core.router.Router
Received request in Router: RequestPrimitive [operation=5,
from=admin:admin,
content={
"m2m:sgn" : {
"nev" : {
"rep" : {
"rn" : "cin_266403336",
"ty" : 4,
"ri" : "/mn-cse/cin-266403336",
"pi" : "/mn-cse/cnt-81533083",
"ct" : "20161216T022158",
"lt" : "20161216T022158",
"st" : 0,
"cnf" : "application/text",
"cs" : 3,
"con" : "293"
},
"rss" : 1
},
"sud" : false,
"sur" : "/mn-cse/mn-name/mysensor/data/managersub"
}
},
requestContentType=application/json,
]
[INFO] - org.eclipse.om2m.core.router.Router
missing ContentType isnull
[INFO] - org.eclipse.om2m.core.router.Router
No Accept parameter set, setting to default: application/xml
[INFO] - org.eclipse.om2m.core.router.Router
Request targeting another CSE, forwarding to Redirector: null
[INFO] - org.eclipse.om2m.core.redirector.Redirector
RemoteCSE found: /in-cse
[ERROR] - org.eclipse.om2m.core.router.Router
Router internal error
java.lang.NullPointerException
at org.eclipse.om2m.core.redirector.Redirector.sendRedirectorRequest(Redirector.java:138)
at org.eclipse.om2m.core.redirector.Redirector.retarget(Redirector.java:84)
at org.eclipse.om2m.core.router.Router.doRequest(Router.java:165)
at org.eclipse.om2m.core.notifier.Notifier.notify(Notifier.java:162)
at org.eclipse.om2m.core.notifier.Notifier$NotificationWorker$1.run(Notifier.java:291)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[INFO] - org.eclipse.om2m.core.router.Router
Response in Router= ResponsePrimitive [responseStatusCode=5000,
content=Router internal error,
to=admin:admin,
from=/mn-cse,
contentType=text/plain,
]
Can anyone give me the instruction to fix this error?
Thank you.
|
|
| |
Re: Router Internal Error when running tutorial application [message #1750308 is a reply to message #1750242] |
Mon, 19 December 2016 19:05 |
Yu-Hao Hsu Messages: 15 Registered: July 2016 |
Junior Member |
|
|
Hi Guillaume Garzone,
Thank you! After I pull the latest version, it works!
But I found that the tutorial code has some error.
In the MyHandler class of MyActuator.java, MyManager.java and MyMonitor.java, when we want to transfer String requestBody to JSONObject, JSONObject json = new JSONObject(requestBody);
there will have the error message:
A JSONObject text must begin with '{' at 1 [character 2 line 1]
It seems that requestBody is a string with XML format, so it didn't start form '{', it start from '<'.
So then I change the code so that it can transfer XML format to JSONObject
JSONObject json = XML.toJSONObject(requestBody);
then it can works.
But there is another part seems not make sense. In the MySensor.java, it send sensorValue, which is Integer format, to my sensor/data(container). But in the MyHandler of MyManager.java, tutorial use the following code:
String con = rep.getString("con");
int sensorValue = Integer.parseInt(con);
It use the getString to get the Integer format, I think there may be some error need to be fixed.
Howard
[Updated on: Mon, 19 December 2016 19:06] Report message to a moderator
|
|
| |
Re: Router Internal Error when running tutorial application [message #1750602 is a reply to message #1750368] |
Fri, 23 December 2016 08:27 |
Yu-Hao Hsu Messages: 15 Registered: July 2016 |
Junior Member |
|
|
hello Mandi,
when I test the original sample code, I get the following error message in the MyHandler of MyManager.java:
Quote:org.json.JSONException: JSONObject["con"] not a string.
at org.json.JSONObject.getString(JSONObject.java:721)
at org.eclipse.om2m.app.MyManager$MyHandler.handle(MyManager.java:100)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Did you know why will be this error message happen?
I try to print out the JSONObject rep, but it looks fine like the following:
rep:{"cs":3,"ct":"20161223T162404","st":0,"con":320,"ty":4,"ri":"/mn-cse/cin-284654618","lt":"20161223T162404","pi":"/mn-cse/cnt-795693924","cnf":"application/text","rn":"cin_284654618"}
|
|
| | | |
Goto Forum:
Current Time: Tue Oct 08 17:55:45 GMT 2024
Powered by FUDForum. Page generated in 0.04639 seconds
|