To test some new functionalities I would like to run the karaf based distro with some components I build myself.
e.g. recently I made some changes in the org.eclipse.smarthome.core.thing.jar file, and I would like to see that it works.
Is there a way to remove the existing one and replace it with the newly build one?
I tried bundle:uninstall and than putting the new jar in the addons folder but that did not seem to do the trick
I would expect it to work this way - what happens on the bundle:uninstall? Does ist still stay installed and activated? What about the new version that you put in the addons folder? Doesnât it turn up on a bundle:list?
Here example for 'Eclipse SmartHome Core Thingâ
it will go (so it does not show up for a while), but it comes back and than both are running.
If I than uninstall/stop the old one once more, I get long log of errors.
tried restarting as well but behaviour is the same.
Looks to me karaf is trying to be too smart and sees the old version as dependency or something, and starts it anyway
openhab> log:tail
13:28:24.255 [WARN ] [ore.internal.events.OSGiEventManager] - Could not find an Event Factory for the event type âThingStatusInfoEventâ.
13:28:45.993 [WARN ] [ore.internal.events.OSGiEventManager] - Could not find an Event Factory for the event type âThingStatusInfoEventâ.
13:28:45.994 [WARN ] [ore.internal.events.OSGiEventManager] - Could not find an Event Factory for the event type âThingStatusInfoChangedEventâ.
13:28:46.017 [WARN ] [ore.internal.events.OSGiEventManager] - Could not find an Event Factory for the event type âThingStatusInfoEventâ.
13:28:46.018 [WARN ] [ore.internal.events.OSGiEventManager] - Could not find an Event Factory for the event type âThingStatusInfoChangedEventâ.
13:28:47.685 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection â497f83d0â
@maggu2810@Kai - normally you can use update command to load new contents of bundle from maven (works the best with SNAPSHOTs). Openhab disables maven repositories in Karaf and does not use local repository. To enable smooth testing you need to uncomment org.ops4j.pax.url.mvn.localRepository property in org.pax.url.mvn.cfg file and point to your local maven repo. Then every update call on bundle which is coming with mvn url will cause scanning of local/remote repositories to find latest version of it. By default distro puts ${openhab.userdata}/tmp/mvn which is not place where you install fresh versions when you build your stuff
Alternatively you can call update command with second argument which is location of JAR file to update installed version ie. update 12 file:/Users/splatch/.m2/repository/org/eclipse/io/smarthome/123/.... (you can copy this path from maven build).
Stop call is not necessary cause update will stop bundle before doing anything and will also try to start it back after itâs done looking for fresh version.
@marcel_verpaalen issue comes from fact that bundles are having dofferent classifiers, so they are not the same. Its issue of eclipse/tycho build. If you will use SNAPSHOT as bundle classifier It will work as expected.
But you do not really want to do it through maven here, because you simply have a single jar without any GAVs - the felix fileinstall (what we use on the âaddonsâ folder) sounds just like the right thing to use.
Not the same version, but this is correct. Isnât it nice if you can see from the file name which of your two jars is actually the newer version that you want to testâŠ?
So if I get it right, the main problem is that Marcel wants to replace a jar which is part of an installed feature, right? So these cannot be manually uninstalled and you need to go through âofficialâ update mechanisms, which is only through Maven.
Bundles installed in openhab are using mvn protocol so they will eventualy go over maven repository and thatâs easiest way to keep updates goin. If you use local repo you can use bundle:watch so it will be automatically updated when maven build completes (this is based on file modification time may have small delay), so itâs much more handy for development than addons which is intented for users to drop their extra bundles without messing too much with console.
[quote=âKai, post:10, topic:7245â]
Not the same version, but this is correct. Isnât it nice if you can see from the file name which of your two jars is actually the newer version that you want to testâŠ?[/quote]
I agree it is nice, but complicates things with development builds where this date doesnât matter. This is conflict between eclipse way and maven. Things built with maven-bundle-plugin are having extra header called Bnd-LastModified which can be used to determine bundle build time. From osgi point of view classifier is not used for wiring and you may end up with conflicts cause you have certain service exported twice and some bundles may get first version of service and other second version depends on startup order so state will be disolved between two services.
@splatch@Kai
I have done this. But although bundle:list show the updated bundle active. But OH2 seem goes wrong after that.
Here is my full sequence.
1 maven build -> local repo
2 OH2âs karaf
update 197
It seems something related to the bundle dependency. Are we supposed to use some command handle this issue?
Thank you very much.
12:21:01.409 [ERROR] [org.eclipse.smarthome.core ] - [org.eclipse.smarthome.core.itemregistry(153)] The activate method has thrown an exception
java.lang.NullPointerException
at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl$StateDescriptionProviderTracker.addingService(ItemRegistryImpl.java:427)
at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl$StateDescriptionProviderTracker.addingService(ItemRegistryImpl.java:1)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)[org.osgi.core-6.0.0.jar:]
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)[org.osgi.core-6.0.0.jar:]
at org.eclipse.smarthome.core.internal.items.ItemRegistryImpl.activate(ItemRegistryImpl.java:404)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_72]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_72]
at org.apache.felix.scr.impl.helper.BaseMethod.invokeMethod(BaseMethod.java:222)
at org.apache.felix.scr.impl.helper.BaseMethod.access$500(BaseMethod.java:37)
at org.apache.felix.scr.impl.helper.BaseMethod$Resolved.invoke(BaseMethod.java:615)
at org.apache.felix.scr.impl.helper.BaseMethod.invoke(BaseMethod.java:499)
at org.apache.felix.scr.impl.helper.ActivateMethod.invoke(ActivateMethod.java:295)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:302)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:113)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:866)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:833)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:774)[33:org.apache.felix.scr:2.0.2]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse$1.run(ServiceFactoryUse.java:212)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at java.security.AccessController.doPrivileged(Native Method)[:1.8.0_72]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.factoryGetService(ServiceFactoryUse.java:210)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.serviceregistry.ServiceFactoryUse.getService(ServiceFactoryUse.java:111)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.serviceregistry.ServiceConsumer$2.getService(ServiceConsumer.java:45)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:496)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.getService(ServiceRegistry.java:461)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.framework.BundleContextImpl.getService(BundleContextImpl.java:619)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.apache.felix.scr.impl.manager.SingleRefPair.getServiceObject(SingleRefPair.java:72)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.helper.BindMethod.getServiceObject(BindMethod.java:646)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.DependencyManager.getServiceObject(DependencyManager.java:2137)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.DependencyManager.invokeUnbindMethod(DependencyManager.java:1765)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.SingleComponentManager.invokeUnbindMethod(SingleComponentManager.java:393)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.DependencyManager$SingleDynamicCustomizer.removedService(DependencyManager.java:826)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.DependencyManager$SingleDynamicCustomizer.removedService(DependencyManager.java:700)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1241)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1136)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.untrack(ServiceTracker.java:996)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1175)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.BundleComponentActivator$ListenerInfo.serviceChanged(BundleComponentActivator.java:120)[33:org.apache.felix.scr:2.0.2]
at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:109)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:914)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:862)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:801)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:222)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.unregister(AbstractComponentManager.java:883)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.AbstractComponentManager$3.unregister(AbstractComponentManager.java:857)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.RegistrationManager.changeRegistration(RegistrationManager.java:140)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterService(AbstractComponentManager.java:925)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.doDeactivate(AbstractComponentManager.java:774)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:757)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:550)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.config.ConfigurableComponentHolder.disposeComponents(ConfigurableComponentHolder.java:725)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.BundleComponentActivator.dispose(BundleComponentActivator.java:530)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.Activator.disposeComponents(Activator.java:414)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.Activator.access$300(Activator.java:53)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.scr.impl.Activator$ScrExtension.destroy(Activator.java:273)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.utils.extender.AbstractExtender$2.run(AbstractExtender.java:290)[33:org.apache.felix.scr:2.0.2]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_72]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_72]
at org.apache.felix.utils.extender.AbstractExtender.destroyExtension(AbstractExtender.java:312)[33:org.apache.felix.scr:2.0.2]
at org.apache.felix.utils.extender.AbstractExtender.bundleChanged(AbstractExtender.java:186)[33:org.apache.felix.scr:2.0.2]
at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:902)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:165)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:75)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:67)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:102)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.Module.publishEvent(Module.java:466)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.Module.doStop(Module.java:624)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.Module.stop(Module.java:488)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer.unresolve0(ModuleContainer.java:841)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer.unresolve(ModuleContainer.java:755)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:953)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1336)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)[org.eclipse.osgi-3.10.2.v20150203-1939.jar:]
12:21:01.416 [ERROR] [org.eclipse.smarthome.core ] - [org.eclipse.smarthome.core.itemregistry(153)] Failed creating the component instance; see log for reason