Search code examples
osgiequinoxkura

OSGi plug-in gets remove after reboot


I have created 3 different OSGI plugins (developed as an Eclipse Plugin project) running inside Eclipse Kura on a Raspberry PI. Two plugins are behaving as a library providing classed used in common. The third plugin is a service communicating with the serial port using the mechanisms provided by Kura. The latter has been developed as described on the Kura getting started pages. The two library plugins are basic plugin projects.

Everything is resolved and started correctly and seems to work as expected, so nothing special about that. Problems appear when the PI is rebooted, causing off course the OSGI engine to restart as well. The two library plugins seems to be removed by the reboot. The serial communication service is still present but fails to start due to missing dependencies.

My question is: what causes the plugins to be removed on reboot and how does one prevent this of happening? Thanks for reading this post!


Solution

  • I suggest that you export your bundles as OSGi Deployment Package.
    Then copy the DP in your Pi and tell Kura to load it at startup.

    I wrote a sample project that you can use to create the the Deployment Package with Maven, or you can package your bundles with a bash script.

    After the packaging, copy your DP into /opt/eclipse/kura/kura/packages/ folder. Then edit the /opt/eclipse/kura/kura/dpa.properties file and add a line for your DP

    yourbundles=file\:/opt/eclipse/kura/kura/packages/your-bundles.dp
    

    This is the official Kura documentation on how to do it.

    Alternatives would be to either install the DP using Kura's web UI or the DEPLOY cloudlet.