PostgreSQL and OH3 error

I upgraded my Openhabian to 3.0 (btw - AMAZING upgrade), I used to have postgresql configured in my persistence, but now I am getting the following. Also putting the jar file in the addon directory does not resolve the issue.

2020-12-26 19:05:43.422 [ERROR] [ence.jdbc.internal.JdbcConfiguration] - JDBC::updateConfig: could NOT load JDBC-driverClassName or JDBC-dataSourceClassName. ClassNotFoundException: 'org.postgresql.
Driver cannot be found by org.openhab.persistence.jdbc_3.0.0'
2020-12-26 19:05:43.425 [WARN ] [ence.jdbc.internal.JdbcConfiguration] -

        !!!
        To avoid this error, place an appropriate JDBC driver file for serviceName 'postgresql' in addons directory.
        Copy missing JDBC-Driver-jar to your openHab/addons Folder.
        !!!
        DOWNLOAD:
        PostgreSQL:version >= 9.4.1208 from           https://mvnrepository.com/artifact/org.postgresql/postgresql

That error is actually telling you what to do. Download the jar for the dependancy from here if you want the latest version of it…
https://repo1.maven.org/maven2/org/postgresql/postgresql/42.2.18/postgresql-42.2.18.jar
Place the second jar also into the addons folder.
If that does not work, check in the console if everything is starting correctly with bundle:list

1 Like

Haha - This is my current /usr/share/openhab/addons directory, what is the second jar you are referring to? Anyway thanks for the tips with bundle:list, I will check what the output says

[22:20:15] openhabian@openhab:/usr/share/openhab/addons$ ls -l
total 208880
-rw-r--r-- 1 openhab openhab 212827893 Dec 21 09:29 openhab-addons-3.0.0.kar
-rw-r--r-- 1 openhab openhab   1004719 Oct 15 09:11 postgresql-42.2.18.jar
-rw-r--r-- 1 openhab openhab        70 Dec 21 09:29 README

Well this is looking odd - yes the jar file is loaded correctly but it doesn’t seem to be sufficient

290 │ Active │  80 │ 3.0.0                   │ openHAB Add-ons :: Bundles :: Voice :: Mary Text-to-Speech
291 │ Active │  80 │ 3.0.0                   │ openHAB Add-ons :: Bundles :: Voice :: Pico Text-to-Speech
292 │ Active │  80 │ 9.4.1212                │ PostgreSQL JDBC Driver JDBC42
293 │ Active │  80 │ 1.0.2                   │ reactive-streams
294 │ Active │  80 │ 3.0.0                   │ openHAB Add-ons :: Bundles :: WiZ Lighting Binding
295 │ Active │  80 │ 42.2.18                 │ PostgreSQL JDBC Driver

Interesting the maven website only goes to 9.4.1206 and the link I gave was for the much newer 42.x versions. Remove the jar that was linked in my post as it probably is too new and the bundle:list is showing 9.4.1212 is active on your system.

Have you tried a reboot?

I am not familiar with that library sorry, it may be that you need the exact version that it is asking for if there were breaking changes in the newer 9.4.1212 version.

I tried reboot, nothing - also finally figured the addon repository contains the bundled 9.4.1212 postgresql version so I guess without hacking the kar file, not sure you can actually change the jdbc version. Knowing that it is a JDBC issue, I’m worried that there is another error trying to load the driver that might not be visible in the logs… I need to figure out how logging works in this new version…

Something else rather odd - I decided to use InfluxDB 2 as main persistence and stopped the postgresql database. When I did this, I started to see Java exceptions coming from the postgresql driver itself - so something was working although it complained about driver.