mycontroller-v1-legacy: (FOTA) java.lang.IllegalArgumentException:null value

Hi, not sure what is causing this error but it seems to prohibit FOTA from happening on my system…

Server log

2018-03-12 19:10:45,625 ERROR [Thread-5] [org.mycontroller.standalone.message.MessageMonitorThread:119] Throws exception while processing!, [RawMessage(gatewayId=1, data=010002003F03, subData=AD_gw_out/111/255/4/0/2, isTxMessage=false, networkType=MY_SENSORS, timestamp=1520896245570)]
java.lang.IllegalArgumentException: null value
	at org.mapdb.HTreeMap.put(HTreeMap.java:481)
	at org.mycontroller.standalone.firmware.FirmwareUtils.getFirmwareDataFromOfflineMap(FirmwareUtils.java:281)
	at org.mycontroller.standalone.message.McMessageEngine.procressFirmwareRequestMySensors(McMessageEngine.java:550)
	at org.mycontroller.standalone.message.McMessageEngine.streamSubMessageTypeSelector(McMessageEngine.java:504)
	at org.mycontroller.standalone.message.McMessageEngine.execute(McMessageEngine.java:125)
	at org.mycontroller.standalone.message.McMessageEngine.run(McMessageEngine.java:1117)
	at org.mycontroller.standalone.message.McMessageUtils.sendToMcMessageEngine(McMessageUtils.java:677)
	at org.mycontroller.standalone.provider.mysensors.MySensorsProviderBridge.executeRawMessage(MySensorsProviderBridge.java:59)
	at org.mycontroller.standalone.message.McMessageUtils.sendToProviderBridge(McMessageUtils.java:579)
	at org.mycontroller.standalone.message.MessageMonitorThread.processRawMessage(MessageMonitorThread.java:107)
	at org.mycontroller.standalone.message.MessageMonitorThread.run(MessageMonitorThread.java:182)
	at java.lang.Thread.run(Thread.java:748)

Resources logs detail

Mar 12, 2018 19:34:33 | Notice | Node | AD_gateway   111:000 Battery, RSSI, FOTA | Sent | Stream | [Firmware config response] 010002004003A795
Mar 12, 2018 19:34:32 | Notice | Node | AD_gateway   111:000 Battery, RSSI, FOTA | Received | Stream | [Firmware config request] 010002004003429D0102
Mar 12, 2018 19:34:30 | Notice | Node | AD_gateway   111:000 Battery, RSSI, FOTA | Sent | Stream | [Firmware config response] 010002004003A795
Mar 12, 2018 19:34:29 | Notice | Node | AD_gateway   111:000 Battery, RSSI, FOTA | Received | Stream | [Firmware config request] 010002004003429D0102

The above two lines just keep on repeating every couple of seconds. Not sure if that means the node is in a reboot loop…

Typos ?

procressFirmwareRequestMySensors -> processFirmwareRequestMySensors Discover respone -> Discover response

Node info

Using MySensorsBootloaderRF24: v1.3.0-rc.1 Using MySensors: v2.2.0 Arduino: Nano (chinese clone) with 8 analog pins Radio: NRF24L-01 #define MY_NODE_ID 111

MyController

Version 1.1.0.Final Database schema revision 1.04.01 - 2017 Oct 25 Database type MySQL Database version 10.1.23-MariaDB-9+deb9u1 Git commit:branch 2bd938160d42fb36e8b47b4e9c62cad446773a5b:master Built on 2017-12-28T07:46:41+0530 Build JDK 1.8.0_151 Build tool Apache Maven 3.5.0 VM vendor Oracle Corporation VM name Java HotSpot™ Client VM VM version 1.8.0_162-b12 Java home /opt/jdk1.8.0_162/jre Operating system Linux Architecture arm Version/Kernel 4.9.59+

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (8 by maintainers)

Commits related to this issue

Most upvoted comments

You’re right… It only worked the first time. The second test failed. I will experiment with different radio powers and packet sizes over the weekend (if time permits) and let you know what I find. Thanks for the support, it’s appreciated!

found: (in …\libraries\MySensors/drivers/PubSubClient/PubSubClient.h) #define MQTT_MAX_PACKET_SIZE 128

trying to override it with: #define MQTT_MAX_PACKET_SIZE 512 in the sketch

seeing progress now…

…and it worked, finally!

Updated MyController to Version 1.3.0 snapshot

Actions and findings as follows

I get a lot of these errors… makes debugging a little more difficult. Notice it still says “Discover respone” here instead of “Discover response”

2018-03-14 10:39:22,670 ERROR [mc-th-pool-0] [org.mycontroller.standalone.provider.EngineAbstract:261] Throws exception while processing!, [MessageImpl(gatewayId=1, nodeEui=4, sensorId=SENSOR_BC, type=Internal, subType=Discover respone, ack=0, payload=0, isTxMessage=false, timestamp=1521038358021, properties=null)]
java.lang.NullPointerException: null
	at org.mycontroller.standalone.provider.ExecuterAbstract.executeInternal(ExecuterAbstract.java:138)
	at org.mycontroller.standalone.provider.ExecuterAbstract.execute(ExecuterAbstract.java:86)
	at org.mycontroller.standalone.provider.EngineAbstract.auditQueue(EngineAbstract.java:256)
	at org.mycontroller.standalone.provider.EngineAbstract.run(EngineAbstract.java:131)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

After rebooting node 111 with firmware 222, I got a warning:

2018-03-14 10:45:25,771 WARN [mc-th-pool-0] [org.mycontroller.standalone.provider.mysensors.MySensorsExecutor:73] Requested firmware is not available in MyController server. FirmwareRequest[typeId:1, versionId:3, block:831]

I then tried to edit the firmwares and re-upload the hex files, which gave the following error

2018-03-14 10:48:19,833 ERROR [Acme.Utils.ThreadPool(1)-PooledThread: Acme.Serve.Serve$ServeConnection@f93ea5] [org.mycontroller.standalone.api.jaxrs.exception.mappers.ApplicationExceptionMapper:42] ApplicationException,
org.jboss.resteasy.spi.ApplicationException: java.lang.NullPointerException
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:152)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
	at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
	at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
	at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
	at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: null
	at org.mycontroller.standalone.firmware.FirmwareUtils.updateFirmwareHex(FirmwareUtils.java:172)
	at org.mycontroller.standalone.firmware.FirmwareUtils.createUpdateFirmware(FirmwareUtils.java:226)
	at org.mycontroller.standalone.api.jaxrs.FirmwareHandler.updateFirmware(FirmwareHandler.java:226)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
	... 15 common frames omitted

I then deleted the 3 existing firmwares from mycontroller and tried to add them again:

2018-03-14 10:51:00,492 ERROR [Acme.Utils.ThreadPool(2)-PooledThread: Acme.Serve.Serve$ServeConnection@165475c] [org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl:247] unable to add new item:[FirmwareData(id=null, firmware=Firmware(id=12, type=FirmwareType(id=1, name=FOTA test node, newId=null), version=FirmwareVersion(id=1, version=v.001, newId=null), timestamp=1521039058145, properties={crc=13661, blocks=832, type=Hex, blockSize=16}, fileString=null, fileBytes=null, fileType=null, blockSize=null))]
java.sql.SQLException: Unable to run insert stmt on object FirmwareData(id=null, firmware=Firmware(id=12, type=FirmwareType(id=1, name=FOTA test node, newId=null), version=FirmwareVersion(id=1, version=v.001, newId=null), timestamp=1521039058145, properties={crc=13661, blocks=832, type=Hex, blockSize=16}, fileString=null, fileBytes=null, fileType=null, blockSize=null)): INSERT INTO `firmware_data` (`id` ,`firmwareId` ,`data` ) VALUES (?,?,?)
	at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:25)
	at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:137)
	at com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:458)
	at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:328)
	at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.create(BaseAbstractDaoImpl.java:244)
	at org.mycontroller.standalone.firmware.FirmwareUtils.createUpdateFirmware(FirmwareUtils.java:243)
	at org.mycontroller.standalone.api.jaxrs.FirmwareHandler.createFirmware(FirmwareHandler.java:237)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)
	at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)
	at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
	at org.jboss.resteasy.plugins.server.tjws.TJWSServletDispatcher.service(TJWSServletDispatcher.java:40)
	at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2328)
	at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2282)
	at Acme.Serve.Serve$ServeConnection.run(Serve.java:2054)
	at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1402)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLDataException: Data too long for column 'data' at row 1

So, I opened up phpMyAdmin and changed the table structure for the data field from BLOB to LONGBLOB:

ALTER TABLE `firmware_data` CHANGE `data` `data` LONGBLOB NOT NULL;

Then I tried to edit the firmware again, and got the same error as before. …see error above…

Then I deleted the 3 firmwares and added them again, this time there was no error. … guess we will need to use LONGBLOB 😃

So I edited the node 111 again, assigned firmware 222, and rebooted the node. No errors were reported in the server log and this is what came up in the Resources logs detail:

Mar 14, 2018 11:04:32 | Notice | Node | AD_gateway   111:111 Battery, RSSI, FOTA | Sent | Stream | [Firmware config response] 010002004003790A
  | Mar 14, 2018 11:04:32 | Notice | Node | AD_gateway   111:111 Battery, RSSI, FOTA | Received | Stream | [Firmware config request] 01000200400316510102
  | Mar 14, 2018 11:04:29 | Notice | Node | AD_gateway   111:111 Battery, RSSI, FOTA | Sent | Stream | [Firmware config response] 010002004003790A
  | Mar 14, 2018 11:04:28 | Notice | Node | AD_gateway   111:111 Battery, RSSI, FOTA | Received | Stream | [Firmware config request] 01000200400316510102
  | Mar 14, 2018 11:04:24 | Notice | Node | AD_gateway   111:111 Battery, RSSI, FOTA | Sent | Internal | [Reboot]

The node came back up again but with the old version (111) still showing. I also tried refreshing the node, but still got the same version.

Then I edited node 111 again, changed firmware to version 333, issued a reboot command. … this time there were no firmware config requests or responses in the Resources logs detail and no errors in the Server log. I will give it an hour to see if something is happening.

Additional Info

  • am using MySQL/MariaDB as I find it easier to use phpMyAdmin than command line in H2
  • MyController is running on a RaspberryPi Zero with 4GB card
  • gateway is Arduino UNO with W5100 shield
  • nodes are all arduino nano with NRF24L01
  • only one node (111) is set up with MYSBootloader (for testing).
  • have three different firmwares created for testing (versions 111, 222 and 333)