JDBC type cast error for Color item

Hi all,

I’ve got this strange type cast error for the jdbc persistence. It’s succesfully creating tables and writing data into the tables. In the attached debug log you can see the data gets read from the database as well (timestamp: 2021-09-22 20:50:36.233). But then there is a class java.lang.String cannot be cast to class java.lang.Integer error.

I’m on Openhab 3.1.0. Any advice will be greatly appreciated.

Here’s the debug log:

2021-09-22 20:50:36.223 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::query: item is Fornuis_Gu10_1_Color_Scene0
2021-09-22 20:50:36.224 [DEBUG] [persistence.jdbc.internal.JdbcMapper] - JDBC::getHistItemFilterQuery filter='true' numberDecimalcount='3' table='fornuis_gu10_1_color_scene0_314' item='Fornuis_Gu10_1_Color_Scene0 (Type=ColorItem, State=NULL, Label=M0: Fornuis_Gu10 1, Category=null, Groups=[gLoadOnBoot])' itemName='Fornuis_Gu10_1_Color_Scene0'
2021-09-22 20:50:36.224 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::getHistItemFilterQueryProvider filter = org.openhab.core.persistence.FilterCriteria@42bc5006, numberDecimalcount = 3, table = fornuis_gu10_1_color_scene0_314, simpleName = Fornuis_Gu10_1_Color_Scene0
2021-09-22 20:50:36.225 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::query queryString = SELECT time, value FROM fornuis_gu10_1_color_scene0_314 ORDER BY time DESC  LIMIT 0,1
2021-09-22 20:50:36.225 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::doGetHistItemFilterQuery sql=SELECT time, value FROM fornuis_gu10_1_color_scene0_314 ORDER BY time DESC  LIMIT 0,1
2021-09-22 20:50:36.226 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::query: query for Fornuis_Gu10_1_Color_Scene0 returned 0 rows in 2 ms
2021-09-22 20:50:36.228 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::query: item is GF_KeukenBloom_Color_Scene0
2021-09-22 20:50:36.229 [DEBUG] [persistence.jdbc.internal.JdbcMapper] - JDBC::getHistItemFilterQuery filter='true' numberDecimalcount='3' table='gf_keukenbloom_color_scene0_315' item='GF_KeukenBloom_Color_Scene0 (Type=ColorItem, State=NULL, Label=M0: Keuken Bloom, Category=null, Groups=[gLoadOnBoot, gGF_Scene0])' itemName='GF_KeukenBloom_Color_Scene0'
2021-09-22 20:50:36.229 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::getHistItemFilterQueryProvider filter = org.openhab.core.persistence.FilterCriteria@2ec5a8db, numberDecimalcount = 3, table = gf_keukenbloom_color_scene0_315, simpleName = GF_KeukenBloom_Color_Scene0
2021-09-22 20:50:36.232 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::query queryString = SELECT time, value FROM gf_keukenbloom_color_scene0_315 ORDER BY time DESC  LIMIT 0,1
2021-09-22 20:50:36.232 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::doGetHistItemFilterQuery sql=SELECT time, value FROM gf_keukenbloom_color_scene0_315 ORDER BY time DESC  LIMIT 0,1
2021-09-22 20:50:36.233 [DEBUG] [nhab.persistence.jdbc.db.JdbcBaseDAO] - JDBC::ItemResultHandler::handleResult getState value = '24,100,0', unit = 'null', getClass = 'class java.lang.String', clazz = 'String'
2021-09-22 20:50:36.234 [ERROR] [nal.common.AbstractInvocationHandler] - An error occurred while calling method 'QueryablePersistenceService.query()' on 'org.openhab.persistence.jdbc.internal.JdbcPersistenceService@5d58aad3': class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
        at org.openhab.persistence.jdbc.db.JdbcBaseDAO.objectAsInteger(JdbcBaseDAO.java:540) ~[?:?]
        at org.openhab.persistence.jdbc.db.JdbcBaseDAO.getState(JdbcBaseDAO.java:510) ~[?:?]
        at org.openhab.persistence.jdbc.db.JdbcBaseDAO.lambda$0(JdbcBaseDAO.java:344) ~[?:?]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
        at org.openhab.persistence.jdbc.db.JdbcBaseDAO.doGetHistItemFilterQuery(JdbcBaseDAO.java:345) ~[?:?]
        at org.openhab.persistence.jdbc.internal.JdbcMapper.getHistItemFilterQuery(JdbcMapper.java:169) ~[?:?]
        at org.openhab.persistence.jdbc.internal.JdbcPersistenceService.query(JdbcPersistenceService.java:205) ~[?:?]
        at jdk.internal.reflect.GeneratedMethodAccessor102.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]
2021-09-22 20:50:36.253 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::getName: returning name 'jdbc' for queryable persistence service.
2021-09-22 20:50:36.253 [ERROR] [ence.internal.PersistenceManagerImpl] - Exception occurred while querying persistence service 'jdbc': class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Integer (java.lang.String and java.lang.Integer are in module java.base of loader 'bootstrap')
        at org.openhab.persistence.jdbc.db.JdbcBaseDAO.objectAsInteger(JdbcBaseDAO.java:540) ~[?:?]
        at org.openhab.persistence.jdbc.db.JdbcBaseDAO.getState(JdbcBaseDAO.java:510) ~[?:?]
        at org.openhab.persistence.jdbc.db.JdbcBaseDAO.lambda$0(JdbcBaseDAO.java:344) ~[?:?]
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) ~[?:?]
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) ~[?:?]
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) ~[?:?]
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) ~[?:?]
        at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) ~[?:?]
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
        at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) ~[?:?]
        at org.openhab.persistence.jdbc.db.JdbcBaseDAO.doGetHistItemFilterQuery(JdbcBaseDAO.java:345) ~[?:?]
        at org.openhab.persistence.jdbc.internal.JdbcMapper.getHistItemFilterQuery(JdbcMapper.java:169) ~[?:?]
        at org.openhab.persistence.jdbc.internal.JdbcPersistenceService.query(JdbcPersistenceService.java:205) ~[?:?]
        at jdk.internal.reflect.GeneratedMethodAccessor102.invoke(Unknown Source) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.openhab.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:154) [bundleFile:?]
        at org.openhab.core.internal.common.Invocation.call(Invocation.java:52) [bundleFile:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]

Kind regards, Alex