JDBC - MARIA DB Persistence Issue

Hello everyone.

I have this persistence problem that I have not been able to fix so far.

I am using OH3 3.0.2 Release build.

The database server, is the 10.3.27-MariaDB-0 + deb10u1 Raspbian 10 version.

All installed on a Raspberry pi 4, Everything works excelent except the persistence module, for jdbc - MariaDB.

I have runnig the rrd4j persistence too (for a diferent items), and works right.

I reduced, for testing porpouses, the items persistences in the file : etc/openhab/persistence/jdbc.persist, that contains:

Strategies {
     Every1min: "0 * / 1 *? * *"

 Items {
      Test: strategy = everyChange

The service configuration file etc/openhab/services/jdbc.cfg, contains

url = jdbc: mariadb: // 3306 / OpenHAB
user = openhab
password = xxxxxxxx
sqltype.STRING = VARCHAR (65000)

The items configuration file, defined especially for this test, contained in etc/openhab/items/default.items

String Test

Every looks fine when OH3 render the items and jdbc.cfg files: not errors.
2021-07-05 19:16:42.991 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘default.items’
2021-07-05 19:18:03.737 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘jdbc.persist’

But, when i change the content of Test item, appear this error:

2021-07-05 21:11:05.678 [DEBUG] [persistence.jdbc.internal.JdbcMapper] - JDBC::pingDB
2021-07-05 21:11:05.679 [DEBUG] [persistence.jdbc.internal.JdbcMapper] - JDBC::openConnection isDriverAvailable: true
2021-07-05 21:11:05.686 [WARN ] [org.openhab.core.items.GenericItem ] - failed notifying listener ‘org.openhab.core.persistence.internal.PersistenceManagerImpl@109d113’ about state update of item Prueba: class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader ‘bootstrap’)
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader ‘bootstrap’)
at org.openhab.persistence.jdbc.db.JdbcMariadbDAO.doPingDB(JdbcMariadbDAO.java:90) ~[?:?]
at org.openhab.persistence.jdbc.internal.JdbcMapper.pingDB(JdbcMapper.java:72) ~[?:?]
at org.openhab.persistence.jdbc.internal.JdbcMapper.checkDBAccessability(JdbcMapper.java:210) ~[?:?]
at org.openhab.persistence.jdbc.internal.JdbcPersistenceService.store(JdbcPersistenceService.java:136) ~[?:?]
at org.openhab.core.persistence.internal.PersistenceManagerImpl.handleStateEvent(PersistenceManagerImpl.java:152) ~[?:?]
at org.openhab.core.persistence.internal.PersistenceManagerImpl.stateChanged(PersistenceManagerImpl.java:473) ~[?:?]
at org.openhab.core.items.GenericItem.lambda$1(GenericItem.java:259) [bundleFile:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:829) [?:?]
==> /var/log/openhab/events.log <==

2021-07-05 21:11:05.679 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item Test’ changed from t to U

Of course, I have tried items of type number, but I wanted to show here a String item, in such a way that we can see, the problem does not refer to the item itself (string), since the error refers to another type of value(integer to double):

    "**class java.lang.Integer cannot be cast to class java.lang.Long**"

I’ve been reading all the chats about it, but I can’t get a clear solution.
Will anyone know more about it?


I’m having the same issue.
Connection to the DB seems fine, but I get the cast error that Ricardo also mentions and I can’t figure out what to change.

I could post very similar logs but it’s essentially the same issue as above.

Anyone out there with an idea to what could cause this?


Have you resolved the issue?