Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Meta Point ClassCastException

  • Hi all,

    I'm doing a pretty simple meta data point that just scales a data point.
    Once an hour, the original data point is updated with 4 readings.

    Upon doing a simple:

    // original is the external context point
    return original.value/100;

    This works great for history generation but when triggered by the actual point, I end up with 4 entries with the correct timestamps but all having the same value as the most recent reading. Not entirely sure why.

          Original Point                           Meta Point
    -------------------------------       ----------------------------
    TS                   Value       =>   TS                   Value
    -------------------------------       ----------------------------
    7/7/2020 12:00:00    503633.00        7/7/2020 12:00:00    5036.3
    7/7/2020 11:45:00    503584.00        7/7/2020 11:45:00    5036.3
    7/7/2020 11:30:00    503520.00        7/7/2020 11:30:00    5036.3
    7/7/2020 11:15:00    503383.00        7/7/2020 11:15:00    5036.3

    I then tried to be a bit more verbose with:

    // scaled is my meta data point
    scaled.set(original.value/100, original.time);

    but this causes a ClassCastException when generating historic data

    ERROR 2020-07-07T11:42:44,559 (com.serotonin.m2m2.meta.MetaPointLocatorRT.execute:301) - Meta script failed for point Water com.serotonin.ShouldNeverHappenException: java.lang.ClassCastException at ~[mango-3.7.7.jar:?] at ~[mango-3.7.7.jar:?] at ~[mango-3.7.7.jar:?] at 
    com.serotonin.m2m2.meta.JavaScriptPointLocatorRT.executeImpl( ~[?:?] at 
    com.serotonin.m2m2.meta.HistoricalMetaPointLocatorRT.executeImpl( ~[?:?] at 
    com.serotonin.m2m2.meta.MetaPointLocatorRT.execute( ~[?:?] at 
    com.serotonin.m2m2.meta.MetaPointLocatorRT$ ~[?:?] at 
    com.serotonin.timer.Task.runTask( ~[mango-3.7.7.jar:?] at 
    com.serotonin.timer.SimulationTimer.fastForwardTo( ~[mango-3.7.7.jar:?] at 
    com.serotonin.m2m2.meta.HistoricalContextPointRT.consumeHistorical( ~[?:?] at$MetaHistoryGenerationTask.chunkHistoryGeneration( ~[?:?] at$MetaHistoryGenerationTask.lambda$run$6( ~[?:?] at 
    java.util.concurrent.ThreadPoolExecutor.runWorker( ~[?:?] at 
    java.util.concurrent.ThreadPoolExecutor$ ~[?:?] at [?:?] Caused by: java.lang.ClassCastException 

    After a bit more testing, it seems that the meta data script gets run the correct amount of times but only uses the most recent value for each execution.

    edit 2:
    After a bit more debugging, I can confirm that the script will run for each new entry but only uses the value of the most recent entry.