Hi Alireza, As per the log output you have shared, it seems like token renewal is not happening properly due to issue in token retrieval from the response. I have also tried this out and wasn't able to reproduce the issue you are facing with. Anyway this issue might be happen if Refresh token you have used to obtain new token pair is invalid. This might happen if you have modified tokens in deviceConfig.properties file manually or your refresh token got expired.
So one thing you can do is obtain new token pair for your agent and update your deviceConfig.properties file manually with correct tokens. In order to obtain new token pair use following curl command by replacing contents between < and > (Including < and >). curl -k -d "grant_type=password&username=<username>&password=<password>" -H "Authorization: Basic <application-key>" -H "Content-Type: application/x-www-form-urlencoded" https://<IoTS_IP>:8243/token Anyway if you are facing the same issue again and again please provide let us know the steps you have followed. Btw, I haven't noticed your mail for while as you have sent it to my personal email. From here onward, please send any of your WSO2 products related queries to dev@wso2.org and we are happy to help you. Thanks & regards, /charithag > ---------- Forwarded message ---------- > From: Alireza Najjari <alirezanajjar...@gmail.com> > Date: Sun, Dec 3, 2017 at 4:14 PM > Subject: problem in enroll raspberry pi 3 with wso2 iot server > To: chari...@charitha.org > > > Hi, > I'm a student and my project is enroll a raspberry pi with wso2 iot server. > I download wso2 iot server 3.1.0 and do all steps that there's in > documents but when i run testAgent.sh scripts it not connect to wso2 and > show below result: > > MQTT_LISTENER: MQTT_ENDPOINT is ['tcp', '//88.99.109.206', '1886'] > MQTT_LISTENER: MQTT_TOPIC is carbon.super/raspberrypi/sksc2lir038h > MQTT_LISTENER: Sun Dec 3 10:29:44 2017 Connected to MQTT Broker - > 88.99.109.206:1886 > MQTT_LISTENER: Connected with result code 4 > Agent disconnected from broker > Obtaining new access token > MQTT_LISTENER: Exception in MQTTServerThread (either KeyboardInterrupt or > Other) > MQTT_LISTENER: 'refresh_token' > MQTT_LISTENER: Sun Dec 3 10:29:45 2017 Connection to Broker closed - > 88.99.109.206:1886 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > MQTT_LISTENER: Sun Dec 3 10:29:45 2017 Connected to MQTT Broker - > 88.99.109.206:1886 > MQTT_LISTENER: Exception in MQTTServerThread (either KeyboardInterrupt or > Other) > MQTT_LISTENER: 'refresh_token' > Agent disconnected from broker > Obtaining new access token > Exception in thread Thread-2: > Traceback (most recent call last): > File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner > self.run() > File "/usr/lib/python2.7/threading.py", line 754, in run > self.__target(*self.__args, **self.__kwargs) > File "./src/RaspberryAgent.py", line 305, in run > mqttConnector.main() > File "/home/pi/tempdevice/src/mqttConnector.py", line 156, in main > mqttClient.disconnect() > File > "/usr/local/lib/python2.7/dist-packages/paho_mqtt-1.3.1-py2.7.egg/paho/mqtt/client.py", > line 1152, in disconnect > return self._send_disconnect() > File > "/usr/local/lib/python2.7/dist-packages/paho_mqtt-1.3.1-py2.7.egg/paho/mqtt/client.py", > line 2156, in _send_disconnect > return self._send_simple_command(DISCONNECT) > File > "/usr/local/lib/python2.7/dist-packages/paho_mqtt-1.3.1-py2.7.egg/paho/mqtt/client.py", > line 2096, in _send_simple_command > return self._packet_queue(command, packet, 0, 0) > File > "/usr/local/lib/python2.7/dist-packages/paho_mqtt-1.3.1-py2.7.egg/paho/mqtt/client.py", > line 2290, in _packet_queue > return self.loop_write() > File > "/usr/local/lib/python2.7/dist-packages/paho_mqtt-1.3.1-py2.7.egg/paho/mqtt/client.py", > line 1309, in loop_write > rc = self._packet_write() > File > "/usr/local/lib/python2.7/dist-packages/paho_mqtt-1.3.1-py2.7.egg/paho/mqtt/client.py", > line 1908, in _packet_write > self.on_disconnect(self, self._userdata, 0) > File "/home/pi/tempdevice/src/mqttConnector.py", line 105, in > on_disconnect > response = token.updateTokens() > File "/home/pi/tempdevice/src/token_updater.py", line 52, in > updateTokens > self.updateFile(response) > File "/home/pi/tempdevice/src/token_updater.py", line 27, in updateFile > newRefreshToken = response['refresh_token'] > KeyError: 'refresh_token' > > Please help me... > > -- *Charitha Goonetilleke* Senior Software Engineer WSO2 Inc.; http://wso2.com lean.enterprise.middleware mobile: +94 77 751 3669 <%2B94777513669> Twitter:@CharithaWs <https://twitter.com/CharithaWs>, fb: charithag <https://www.facebook.com/charithag>, linkedin: charithag <http://www.linkedin.com/in/charithag> <http://wso2.com/signature>
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev