Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » OM2M » "Error 5000 java.lang.ClassCastException" when creating a subscription from an IN to ASN
"Error 5000 java.lang.ClassCastException" when creating a subscription from an IN to ASN [message #1745051] Tue, 04 October 2016 13:50
Son Duong is currently offline Son DuongFriend
Messages: 60
Registered: June 2016
Member
Hi all,

I tried to create a subscription from an IN to WATER_SENSOR/DATA which located in ASN.

In the IN, I sent the request to ASN:

String targetId;
		 
		targetId = "/" + "asn-cse" + "/" + "asn-name" + "/" + "WATER_SENSOR" + "/" + DATA;

		Subscription sub = new Subscription();

		sub.getNotificationURI().add("http://127.0.0.1:1400/monitor");
		sub.setNotificationContentType(BigInteger.valueOf(2));
		RequestSender.createSubscription(targetId,"WATER_SUBSCRIPTION",sub);


The subscription request seem already came to the ASN router but at the end I received a 5000 error RestClient error
java.lang.ClassCastException
, more details are shown in the file log below:


[2016-10-04 15:33:11,705 INFO] - org.eclipse.om2m.core.router.Router
Received request in Router: RequestPrimitive [operation=1,
to=/asn-cse/asn-name/WATER_SENSOR/DATA,
from=admin:admin,
resourceType=23,
name=WATER_SUBSCRIPTION,
content=org.eclipse.om2m.commons.resource.Subscription@5bc0eafb,
returnContentType=application/obj,
requestContentType=application/obj,
]
[2016-10-04 15:33:11,705 INFO] - org.eclipse.om2m.core.router.Router
Request targeting another CSE, forwarding to Redirector: /asn-cse/asn-name/WATER_SENSOR/DATA
[2016-10-04 15:33:11,823 INFO] - org.eclipse.om2m.core.redirector.Redirector
RemoteCSE found: /asn-cse
[2016-10-04 15:33:11,824 INFO] - org.eclipse.om2m.core.comm.RestClient
the requestIndication RC: RequestPrimitive [operation=1,
to=http://127.0.0.1:8181/~/asn-cse/asn-name/WATER_SENSOR/DATA,
from=admin:admin,
resourceType=23,
name=WATER_SUBSCRIPTION,
content=org.eclipse.om2m.commons.resource.Subscription@5bc0eafb,
returnContentType=application/obj,
requestContentType=application/obj,
]
[2016-10-04 15:33:11,826 INFO] - org.eclipse.om2m.binding.http.RestHttpClient
Sending request: RequestPrimitive [operation=1,
to=http://127.0.0.1:8181/~/asn-cse/asn-name/WATER_SENSOR/DATA,
from=admin:admin,
resourceType=23,
name=WATER_SUBSCRIPTION,
content=org.eclipse.om2m.commons.resource.Subscription@5bc0eafb,
returnContentType=application/obj,
requestContentType=application/obj,
]
[2016-10-04 15:33:11,891 ERROR] - org.eclipse.om2m.core.comm.RestClient
RestClient error
java.lang.ClassCastException: org.eclipse.om2m.commons.resource.Subscription cannot be cast to java.lang.String
at org.eclipse.om2m.binding.http.RestHttpClient.sendRequest(RestHttpClient.java:122)
at org.eclipse.om2m.core.comm.RestClient.sendRequest(RestClient.java:67)
at org.eclipse.om2m.core.redirector.Redirector.sendRedirectorRequest(Redirector.java:129)
at org.eclipse.om2m.core.redirector.Redirector.retarget(Redirector.java:81)
at org.eclipse.om2m.core.router.Router.doRequest(Router.java:160)
at org.eclipse.om2m.sample.evaluatevalues.RequestSender.createResource(RequestSender.java:37)
at org.eclipse.om2m.sample.evaluatevalues.RequestSender.createSubscription(RequestSender.java:58)
at org.eclipse.om2m.sample.evaluatevalues.Monitor.createSubscriptionResources(Monitor.java:89)
at org.eclipse.om2m.sample.evaluatevalues.Monitor.start(Monitor.java:39)
at org.eclipse.om2m.sample.evaluatevalues.Activator$1$1.run(Activator.java:34)
[2016-10-04 15:33:11,891 INFO] - org.eclipse.om2m.core.router.Router
OM2M exception caught in Router: RestClient Error
[2016-10-04 15:33:11,891 INFO] - org.eclipse.om2m.core.router.Router
Response in Router= ResponsePrimitive [responseStatusCode=5000,
content=RestClient Error,
to=admin:admin,
from=/in-cse,
contentType=text/plain,
]


Can anyone help me to fix this error?

Thank you
Son
Previous Topic:asking about receiving notification in OM2M
Next Topic:MN-CSE levels
Goto Forum:
  


Current Time: Sat Oct 12 20:05:58 GMT 2024

Powered by FUDForum. Page generated in 0.03535 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top