openhab / openhab-distro

The binary distribution of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.3k stars 394 forks source link

Queryable persistence service missing - even when active and functional #84

Closed pyjamasam closed 8 years ago

pyjamasam commented 8 years ago

As requested in the forums, issue added.

I have am having an issue trying to use .maximumSince(now.toDateMidnight) in a rule (as well as .minimumSince)

I am using the JDBC persistence service and able to persist data to a mysql database with no issues. I am able to render a chart using the jdbc persistence service as well. So connectivity is definitely up to the db.

When the rule runs to calculate my max and min values I get the following error in the logs: (here is the exact rule line: postUpdate(Weather_Temp_Max, Weather_Temperature.maximumSince(now.toDateMidnight).state))

There is no queryable persistence service registered with the name 'jdbc'

If I turn on tracing for the Jdbc stuffs I see the following (showing up in the log eariler - before the rule is run)

2016-01-15 12:17:45.719 [DEBUG] [jdbc.internal.JdbcPersistenceService] - JDBC::getName: returning name 'jdbc' for queryable persistence service.

At this point I am at a loss as to how to try and figure out whats going on. I am new to openHab and haven't quite wrapped my head around the environment and all the dependencies. I realise things are really in flux right now with OH2, but I was wondering if there were any tips as to how to try and track this issue down.

I have seen this with the mysql persistence service as well so I don't think its an isolated issue to the Jdbc persistence service.

I am using the following builds OH2 (Build #84 from cloudbees) org.openhab.persistence.jdbc-1.9.0-SNAPSHOT.jar (Build #1128 from cloudbees - with a fix to the MANIFEST.MF to include javax.sql and javax.naming so it will load correctly)

pyjamasam commented 8 years ago

Confirmed fixed in OH2 (Build 97 from cloudbees)

kaikreuzer commented 8 years ago

Great to hear, thanks for the feedback!

kgoderis commented 7 years ago

@kaikreuzer This issue seems to be back. I had to manually clear the cache of Karaf, and since then I have

2016-08-05 20:16:05.232 [ERROR] [.eclipse.smarthome.model.persistence] - [org.eclipse.smarthome.core.persistence.manager(90)] The addPersistenceService method has thrown an exception java.lang.AbstractMethodError: org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate.getName()Ljava/lang/String; at org.eclipse.smarthome.model.persistence.internal.PersistenceManager.addPersistenceService(PersistenceManager.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_66] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_66] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_66] at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_66] at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)[41:org.apache.felix.scr:2.0.2]

kgoderis commented 7 years ago

To be complete: based on the Karaf console, the bundles (persistence, rrd4j,...) are loaded/started

kaikreuzer commented 7 years ago

Is this a recent distro?

Could you check the version of your compat1x bundle? It should be 2.0.0.201608032032

kgoderis commented 7 years ago

Yeah - 2-3 weeks old snapshot. With the version you mention.

I will try to remove the cache again.

kgoderis commented 7 years ago

Removed cache. same result....

kgoderis commented 7 years ago

starting the bundle yields

2016-08-05 21:49:32.481 [ERROR] [org.eclipse.smarthome.ui ] - [org.eclipse.smarthome.ui.chart.defaultprovider(111)] The addPersistenceService method has thrown an exception java.lang.AbstractMethodError: org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate.getName()Ljava/lang/String; at org.eclipse.smarthome.ui.internal.chart.DefaultChartProvider.addPersistenceService(DefaultChartProvider.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_66] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_66] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_66] at java.lang.reflect.Method.invoke(Method.java:497)[:1.8.0_66]

Is there a .jar version problem?

kgoderis commented 7 years ago

@kaikreuzer same problem on org.eclipse.smarthome.core.persistence.internal.rest making all UI non-responsive

kgoderis commented 7 years ago

@kaikreuzer based on the exception stack thrown, it seems there is a problem with https://github.com/eclipse/smarthome/commit/c5640548498e3b1be7e9dc574797abb81592329b or related commit, no?

kgoderis commented 7 years ago

@kaikreuzer

The error states:

java.lang.AbstractMethodError: org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate.getName()Ljava/lang/String;

After your refactoring, there is no .persistence.internal.QueryablePersistenceServiceDelegate anymore, and that (I suppose) the replacing interface https://github.com/eclipse/smarthome/blob/master/bundles/core/org.eclipse.smarthome.core.persistence/src/main/java/org/eclipse/smarthome/core/persistence/QueryablePersistenceService.java does not define getName() either....

My runtime has 0.9.0.201607082129 for org.eclipse.smarthome.model.persistence and related bundles

kgoderis commented 7 years ago

If it would help, here is my complete bundle list

START LEVEL 100 , List Threshold: 50

ID | State | Lvl | Version | Symbolic name

10 | Active | 80 | 2.0.0.201606252309 | org.openhab.binding.miele 11 | Active | 80 | 2.0.0.201606252308 | org.openhab.binding.irtrans 12 | Active | 80 | 2.0.0.201608051854 | org.openhab.binding.knx 13 | Active | 80 | 2.0.0.201606252306 | org.openhab.binding.atsadvanced 14 | Active | 80 | 2.0.0.201607142019 | org.openhab.binding.oceanic 15 | Active | 80 | 2.0.0.201606252307 | org.openhab.binding.exec 16 | Active | 80 | 2.0.0.201607142230 | org.openhab.binding.helios 17 | Active | 80 | 2.3.0.201506221200 | com.eclipsesource.jaxrs.provider.gson 18 | Active | 80 | 5.3.1.201602281253 | com.eclipsesource.jaxrs.publisher 19 | Active | 80 | 2.3.1 | com.google.gson 20 | Active | 80 | 18.0.0 | com.google.guava 21 | Active | 80 | 3.0.0.v201312141243 | com.google.inject 22 | Active | 80 | 1.5.8 | io.swagger.annotations 23 | Active | 80 | 3.19.0.GA | javassist 27 | Active | 80 | 1.1.0.Final | javax.validation.api 29 | Active | 80 | 2.0.1 | javax.ws.rs-api 31 | Active | 80 | 3.2.0.v201101311130 | org.antlr.runtime 34 | Active | 80 | 1.6.0 | org.apache.commons.codec 35 | Active | 80 | 3.2.1 | org.apache.commons.collections 36 | Active | 80 | 1.1 | org.apache.commons.exec 37 | Active | 80 | 2.2.0 | org.apache.commons.io 38 | Active | 80 | 2.6 | org.apache.commons.lang 39 | Active | 80 | 3.2.0 | org.apache.commons.net 44 | Active | 80 | 4.2.3 | org.apache.httpcomponents.httpclient 45 | Active | 80 | 4.2.3 | org.apache.httpcomponents.httpcore 63 | Active | 80 | 4.0.4 | org.apache.karaf.shell.core 66 | Active | 80 | 4.0.4 | org.apache.karaf.wrapper.core 67 | Active | 80 | 3.1.0.7 | org.apache.servicemix.bundles.commons-httpclient 69 | Active | 80 | 2.11.0.v20150805-0538 | org.eclipse.emf.common 70 | Active | 80 | 2.11.1.v20150805-0538 | org.eclipse.emf.ecore 71 | Active | 80 | 2.11.1.v20150805-0538 | org.eclipse.emf.ecore.xmi 72 | Active | 80 | 3.7.0.v20150402-1709 | org.eclipse.equinox.common 73 | Active | 80 | 3.6.0.v20150318-1503 | org.eclipse.equinox.registry 99 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.config.core 100 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.config.discovery 101 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.config.dispatch 102 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.config.xml 103 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core 104 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core.autoupdate 105 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core.binding.xml 106 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core.id 107 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core.persistence 108 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core.scheduler 109 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core.thing 110 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core.thing.xml 111 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.core.transform 112 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.audio 113 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.console 114 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.console.karaf 115 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.monitor 116 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.net 117 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.rest 118 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.rest.core 119 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.rest.sitemap 120 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.rest.sse 121 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.io.voice 122 | Active | 85 | 0.9.0.201607082129 | org.eclipse.smarthome.model.core 123 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.item 124 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.item.runtime 125 | Installed | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.persistence 126 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.persistence.runtime 127 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.rule 128 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.rule.runtime 129 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.script 130 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.script.runtime 131 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.sitemap 132 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.sitemap.runtime 133 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.thing 134 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.model.thing.runtime 135 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.storage.mapdb 136 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.ui 137 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.ui.icon 138 | Active | 80 | 0.9.0.201607082129 | org.eclipse.smarthome.ui.iconset.classic 139 | Active | 80 | 2.9.2 | org.eclipse.xtend.lib 140 | Active | 80 | 2.9.2 | org.eclipse.xtend.lib.macro 141 | Active | 80 | 2.9.2 | org.eclipse.xtext 142 | Active | 80 | 2.9.2 | org.eclipse.xtext.common.types 143 | Active | 80 | 2.9.2 | org.eclipse.xtext.smap 144 | Active | 80 | 2.9.2 | org.eclipse.xtext.util 145 | Active | 80 | 2.9.2.v20160428-1452 | org.eclipse.xtext.xbase 146 | Active | 80 | 2.9.2 | org.eclipse.xtext.xbase.lib 162 | Active | 80 | 2.2.0 | org.jupnp 163 | Active | 80 | 1.9.6 | org.jvnet.mimepull 164 | Active | 80 | 1.0.9 | org.mapdb.mapdb 165 | Active | 80 | 5.0.2 | org.objectweb.asm 167 | Active | 90 | 2.0.0.201606271614 | org.openhab.core 168 | Active | 80 | 2.0.0.201606271614 | org.openhab.core.karaf 174 | Active | 80 | 1.1.1.201605111122 | com.eclipsesource.jaxrs.provider.swagger 175 | Active | 80 | 2.4.5 | com.fasterxml.jackson.core.jackson-annotations 176 | Active | 80 | 2.4.5 | com.fasterxml.jackson.core.jackson-core 177 | Active | 80 | 2.4.5 | com.fasterxml.jackson.core.jackson-databind 178 | Active | 80 | 2.4.5 | com.fasterxml.jackson.dataformat.jackson-dataformat-yaml 179 | Active | 80 | 1.5.8 | io.swagger.core 180 | Active | 80 | 1.5.8 | io.swagger.jaxrs 181 | Active | 80 | 1.5.8 | io.swagger.models 182 | Active | 80 | 3.5.0 | javax.jmdns 183 | Active | 80 | 3.4.0 | org.apache.commons.lang3 184 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.io.transport.mdns 185 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.ui.basic, Fragments: 189 186 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.ui.classic 187 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.ui.paper, Fragments: 192 188 | Active | 80 | 2.0.0.201608032032 | org.openhab.io.rest.docs 189 | Resolved | 80 | 2.0.0.201608032032 | org.openhab.ui.basicui, Hosts: 185 190 | Active | 80 | 2.0.0.201608032032 | org.openhab.ui.classicui 191 | Active | 80 | 2.0.0.201608032032 | org.openhab.ui.dashboard 192 | Resolved | 80 | 2.0.0.201608032032 | org.openhab.ui.paperui, Hosts: 187 193 | Active | 80 | 0.9.10.v20160429-1435 | reflections 194 | Active | 80 | 1.5.8.v20160511-1038 | swagger-jersey2-jaxrs 195 | Active | 80 | 2.0.0.201608050102 | org.openhab.binding.astro 196 | Active | 80 | 2.0.0.201608050102 | org.openhab.binding.hdanywhere 197 | Active | 80 | 1.9.0.201608050111 | org.openhab.binding.http 198 | Active | 80 | 2.0.0.201608032032 | org.openhab.core.compat1x 199 | Active | 80 | 2.0.0.201608050102 | org.openhab.binding.keba 200 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.binding.lifx 201 | Active | 80 | 2.0.0.201608050102 | org.openhab.binding.network 202 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.binding.ntp 203 | Active | 80 | 2.0.0.201608050102 | org.openhab.binding.rme 204 | Active | 80 | 2.0.0.201608032032 | org.openhab.io.transport.serial 205 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.io.transport.upnp 206 | Active | 80 | 2.0.0.201608050102 | org.openhab.binding.samsungtv 207 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.binding.sonos 208 | Active | 80 | 2.0.0.201608050102 | org.openhab.binding.systeminfo 209 | Active | 80 | 2.0.0.201608050102 | org.openhab.binding.tesla 210 | Active | 80 | 1.9.0.201608050111 | org.openhab.persistence.rrd4j 211 | Active | 80 | 1.9.0.201608050111 | org.openhab.action.mail 212 | Active | 80 | 1.9.0.201608050111 | org.openhab.action.pushover 213 | Active | 80 | 1.9.0.201608050111 | org.openhab.io.multimedia.tts.marytts 214 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.transform.map 215 | Active | 80 | 2.0.0 | com.jayway.jsonpath.json-path 216 | Active | 80 | 1.0.2 | net.minidev.asm 217 | Active | 80 | 2.1.1 | net.minidev.json-smart 218 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.transform.jsonpath 219 | Active | 80 | 0.9.0.201608031951 | org.eclipse.smarthome.transform.xslt

kgoderis commented 7 years ago

@kaikreuzer For my understanding, it is a fact that the core classes for the runtime are never updated via karaf features, and require a regular/blank installation of the runtime? e.g. org.eclipse.smarthome.ui.internal.chart update sits in feature esh-ui, but the reference to mvn:org.eclipse.smarthome.ui/org.eclipse.smarthome.ui/0.9.0-SNAPSHOT is part of the repo-list, and thus, will not be updated?

If the case, is this something that will change in the future? if non-core features get updated, it would be logical that the core bundles they depend on are also automatically updated, no?

kaikreuzer commented 7 years ago

Yeah - 2-3 weeks old snapshot. With the version you mention.

Ah, you are living in the future :-) The version I mentioned was from Aug 3!

I personally always use the offline distro and deleting the cache of the online distro is nothing that I ever considered a use case. We still have to work out a mechanism of how to update from one version to another, this is nothing that is in place yet.

I have no clue why some of the ESH bundles in your installation are old and some are recent; maybe it is due to what remote repos the online distro has configured and what gets installed. It needs to be analyzed and sorted out.

For now I would recommend that if you clear the cache that you also replace the runtime folder by the most recent version - then the bundles should hopefully be in sync.

kgoderis commented 7 years ago

Yeah - the core bundles are 3 weeks old but the features are 3/8/16....

The upgrade process is messy, I am cooking a script with it will never fit the bill for everyone....

xsnrg commented 7 years ago

Feel free to copy/fork/otherwise abuse my script that already handles this. I always use the online distribution, so any time I do an update, I clear out the cache and force libs and dependencies to re-download. The problem with this is all the dependency loading at start up. Lots of things are not there at start, and the the log has a lot of errors in it. Once everything is loaded and calmed down, I restart and the log is usually clean after. This is how I am able to keep the online distro up to date and to keep from having problems like @kgoderis . Another person modified it for windows.

https://github.com/xsnrg/OpenHAB2-tools