>>>>> Jean-Baptiste Onofré <[email protected]>: > Hi Steinar, > you have an example here:
> https://github.com/apache/karaf/blob/main/bundle/core/src/main/java/org/apache/karaf/bundle/command/BundleCommand.java#L45 > Basically, just add @Reference on BundleContext field and you will > have it injected. Thanks! That worked! What didn't work, however, was replacing ClassLoaderResourceAccessor with OSGiResourceAccessor. Turns out that I was relying on the behaviour of ClassLoaderResourceAccessor, which got its classloader from the current class. And I have a setup where library bundle ukelonn.db.liquibase contains the schema and bundle ukelonn.db.liquibase.test contains the DS component that sets up the schema and populates the database with dummy data. And when I switched to OSGiResourceAccessor, the component in ukelonn.db.liquibase.test was what got the BundleContext and sent it on to the class from the ukelonn.db.liquibase and... it didn't find the files in the classpath of bundle ukelonn.db.liquibase. So I need to rethink: either back off from replacing ClassLoaderResourceAccessor with OSGiResourceAccessor, or turn the library bundle into a component?
