Comments (17)
You should fix it in both, so that QuantityType
can be persisted and restored.
from openhab-addons.
You should fix it in both, so that
QuantityType
can be persisted and restored.
Would do similar to the influxdb implementation.
from openhab-addons.
Just trying to fix this bug and figured out, that the driver is still 2.3.1 from 2015 so in order to create some unittests, to properly fix this bug. I need to implement this #16310 as well. At least with the 4.4 driver.
from openhab-addons.
Upgrading such an old driver sounds good. Do you know if it is backward compatible, so older versions of MongoDB can still be used?
from openhab-addons.
Upgrading such an old driver sounds good. Do you know if it is backward compatible, so older versions of MongoDB can still be used?
@J-N-K Just did a quick check. When we use the latest Java Sync driver (4.11) we would support all MongoDB versions down to 3.6 see the Compatibility
3.6 is EOL since April 2021 - see the lifecycles
So I recommend to use 4.11.
Let's see whether I get some tests implemented as well ;-)
from openhab-addons.
@J-N-K Before I search too long - I've updated the driver and get this at the end of the build:
[INFO] --- karaf:4.4.4:verify (karaf-feature-verification) @ org.openhab.persistence.mongodb ---
[INFO] Using repositories: https://openhab.jfrog.io/openhab/libs-release@id=openhab-release,https://openhab.jfrog.io/openhab/libs-snapshot@id=openhab-snapshot@noreleases@snapshots,https://repo1.maven.org/maven2@id=central
[WARNING] Feature resolution failed for [openhab-persistence-mongodb/4.2.0.SNAPSHOT]
Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-persistence-mongodb; type=karaf.feature; version=4.2.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-persistence-mongodb)(type=karaf.feature)(version>=4.2.0.SNAPSHOT))" [caused by: Unable to resolve openhab-persistence-mongodb/4.2.0.SNAPSHOT: missing requirement [openhab-persistence-mongodb/4.2.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.persistence.mongodb; type=osgi.bundle; version="[4.2.0.202401232117,4.2.0.202401232117]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.persistence.mongodb/4.2.0.202401232117: missing requirement [org.openhab.persistence.mongodb/4.2.0.202401232117] osgi.wiring.package; filter:="(&(osgi.wiring.package=com.mongodb)(version>=4.11.0)(!(version>=5.0.0)))"]]
Repositories: {
file:/home/rene/dev_container/openhabdev/openhab-addons/bundles/org.openhab.persistence.mongodb/target/feature/feature.xml
mvn:org.apache.karaf.features/framework/4.4.4/xml/features
mvn:org.apache.karaf.features/specs/4.4.4/xml/features
mvn:org.apache.karaf.features/standard/4.4.4/xml/features
mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/4.2.0-SNAPSHOT/xml/features
mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-tp/4.2.0-SNAPSHOT/xml/features
mvn:org.ops4j.pax.web/pax-web-features/8.0.22/xml/features
}
I could not find where to adjust the package dependencies further. Do you have any hint?
from openhab-addons.
How did you update the driver? As the latest version on maven is 3.12.14
Newer versions are listed under a different package name: mongodb-driver-sync
When you update the pom.xml it should work, you only have to fix the build errors by adapting the code :-)
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>4.11.1</version>
</dependency>
from openhab-addons.
As mentioned there we have to go to https://mvnrepository.com/artifact/org.mongodb/mongodb-driver-sync for the later version. The build and test is successfull, but the last step fails.
from openhab-addons.
I can't reproduce that error as with the changed pom.xml it builds up to the part that it fails because some Types do not exist, and that is expected with such a verison bumb. No issue with dependencies.
from openhab-addons.
org.mongodb/mongodb-driver-sync/4.11.1 seems to be the correct artifact.
Maybe you need to add org.mongodb/mongodb-driver-core/4.11.1 and org.mongodb/bson/4.11.1 to the dependencies.
from openhab-addons.
@J-N-K @lsiepel Thanks for your efforts, but so far no luck. Like I mentioned earlier, the build works, I did fix the type problems. The only build step which fails is "karaf:verify" - I can even find the created jar file.
So this seems to be something I miss in the karaf runtime dependencies, which needs to be added.
The resulting feature.xml looks good to me:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="org.openhab.persistence.mongodb-4.2.0-SNAPSHOT">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/4.2.0-SNAPSHOT/xml/features</repository>
<feature name="openhab-persistence-mongodb" description="MongoDB Persistence" version="4.2.0.SNAPSHOT">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.persistence.mongodb/4.2.0-SNAPSHOT</bundle>
</feature>
<feature name="org.openhab.persistence.mongodb" description="openHAB Add-ons :: Bundles :: Persistence Service :: MongoDB" version="4.2.0.SNAPSHOT">
<details>This project contains the official add-ons of openHAB</details>
<feature prerequisite="true" dependency="false">wrap</feature>
<bundle start-level="80">mvn:org.mongodb/mongodb-driver-sync/4.11.1</bundle>
<bundle start-level="80">mvn:org.mongodb/bson/4.11.1</bundle>
<bundle start-level="80">mvn:org.mongodb/mongodb-driver-core/4.11.1</bundle>
<bundle start-level="80">mvn:org.mongodb/mongodb-crypt/1.8.0</bundle>
<bundle start-level="80">mvn:net.java.dev.jna/jna/5.11.0</bundle>
<bundle start-level="80">mvn:org.slf4j/slf4j-api/2.0.11</bundle>
<bundle start-level="80">wrap:mvn:org.lastnpe.eea/eea-all/2.2.1</bundle>
</feature>
</features>
You might want to give it a try with the commit and see whether you receive the same build errors.
Build command I use: mvn clean install -T 1C -pl :org.openhab.persistence.mongodb
from openhab-addons.
Tried your commit and play with it for over an hour, but i fail to see what is wrong. I'm no karaf/feature/dependency expert, so hope someone else has time to look into this.
from openhab-addons.
Got a bit further, now it fails in openhab ;-)
2024-01-24 22:21:06.661 [WARN ] [org.apache.felix.fileinstall ] - Error while starting bundle: file:/openhab/addons/org.openhab.persistence.mongodb-4.2.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.persistence.mongodb [259]
Unresolved requirement: Import-Package: com.mongodb; version="[4.11.0,5.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.18.0.jar:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:445) ~[org.eclipse.osgi-3.18.0.jar:?]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.7.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.7.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.7.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.7.4]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.7.4]
Used this feature.xml
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.persistence.mongodb-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
<feature name="openhab-persistence-mongodb" description="MongoDB Persistence" version="${project.version}">
<feature prerequisite="false" dependency="false">openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.mongodb/mongodb-driver-sync/4.11.1</bundle>
<bundle start-level="80">mvn:org.mongodb/bson/4.11.1</bundle>
<bundle start-level="80">mvn:org.mongodb/mongodb-driver-core/4.11.1</bundle>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.persistence.mongodb/${project.version}</bundle>
</feature>
</features>
Next step - learning how to either load the driver during runtime or include it in the jar file...
from openhab-addons.
You don't need to add anything to the feature.xml. Just add all dependencies to the pom.xml with scope compile
. They are embedded automatically. If the feature resolution fails, you didn't add all needed bundles to the POM.
from openhab-addons.
@J-N-K Thanks for the hint - so far this did not change anything. Got a bit further - now it complains about missing com.amazonaws.auth - and when I drill further even more missing things pop up. So I make progress and will continue later on...
from openhab-addons.
In case of com.amazon.auth
I believe it might be really necessary, for optional dependencies (i.e. needed for features we don't use), you can add a <bnd.importpackage>
property, see https://next.openhab.org/docs/developer/buildsystem.html#external-dependency
from openhab-addons.
@J-N-K Thanks for the hints - it took me some time to get all dependencies right and it finally works with MongoDB 6.0 ;-)
Before creating the pull request - I will fix the bug here and add some unittests as well.
from openhab-addons.
Related Issues (20)
- [mybmw] make update interval more flexible and introduce manual updates HOT 15
- Performance issues with rrdj4 HOT 1
- [tado] Change DecimalType channels to deliver QuantityType values HOT 1
- [homekit] Add to iOS Shortcuts, types of control items - DateTime, Image, Location, Player, Group are all missing
- [squeezebox] Power on for notification sometimes plays parts of current playlist item first
- [shelly] Blu Gateway script crashes when receiving unknown attribute HOT 1
- [jsscripting] divide using quantity provides wrong results HOT 2
- Z-Wave JS official integration HOT 27
- [XMPP] not functional EDIT: at first start HOT 3
- [Tesla] Tesla Account Handler Acces token refresh not working HOT 14
- [Melcloud] triggering "We have detected excessive traffic from your account" and not working HOT 17
- [sensibo] Add support for CO2 and TVOC readings from Sensibo AirQ / Pro
- [Tesla Binding] Unable to fetch list of vehicles HOT 2
- [shelly] Support for Shelly Plus H&T 3rd Gen HOT 2
- [shelly] Support for Plus RGBW PM
- [shelly] Support for Shelly Button Tough 1
- [shelly] Support for Shelly BLU H&T
- [shelly] Support for Shelly Pro Dimmer 1PM
- [shelly] Support for Shelly Pro Dimmer 2PM HOT 2
- [shelly] TRV target temperature does not apply or refresh
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openhab-addons.