Details
Description
Issue description
When installing a host and a bunch of fragment bundles, the fragments do not get resolved properly. This worked in Karaf 2.4.3 but does not work anymore in 4.1.2. See steps on how to reproduce.
How to reproduce
Run mvn clean install on a project with the following pom.xml to get the dependencies in your local .m2 repository:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.karaf</groupId> <artifactId>refresh-issue</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>com.vaadin</groupId> <artifactId>vaadin-themes</artifactId> <version>7.2.7</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.opennms.features.themes</groupId> <artifactId>jmxconfiggenerator-theme</artifactId> <version>21.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.opennms.features.themes</groupId> <artifactId>dashboard-theme</artifactId> <version>21.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.opennms.features.themes</groupId> <artifactId>onms-default-theme</artifactId> <version>21.0.0</version> <scope>provided</scope> </dependency> </dependencies> <repositories> <repository> <snapshots><enabled>false</enabled></snapshots> <releases><enabled>true</enabled></releases> <id>opennms-repo</id> <name>OpenNMS Repository</name> <url>http://maven.opennms.org/content/groups/opennms.org-release</url> </repository> </repositories> </project>
Download latest Karaf 4.1.2 version and start it:
./bin/karaf
Nothing installed:
karaf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name ───┼────────┼─────┼─────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 28 │ Active │ 80 │ 4.1.2 │ Apache Karaf :: OSGi Services :: Event karaf@root()>
Install host and fragments:
install -s mvn:com.vaadin/vaadin-themes/7.2.7
install mvn:org.opennms.features.themes/dashboard-theme/21.0.0
install mvn:org.opennms.features.themes/jmxconfiggenerator-theme/21.0.0
install mvn:org.opennms.features.themes/onms-default-theme/21.0.0
The bundles are installed, but not resolved (this is expected behaviour!):
araf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name ───┼───────────┼─────┼─────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 28 │ Active │ 80 │ 4.1.2 │ Apache Karaf :: OSGi Services :: Event 52 │ Active │ 80 │ 7.2.7 │ vaadin-themes 53 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Dashboard 54 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: JMX Configuration Generator 55 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Default karaf@root()>
Manually refresh, to resolve. Did not work!
karaf@root()> bundle:refresh karaf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name ───┼───────────┼─────┼─────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 28 │ Active │ 80 │ 4.1.2 │ Apache Karaf :: OSGi Services :: Event 52 │ Active │ 80 │ 7.2.7 │ vaadin-themes 53 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Dashboard 54 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: JMX Configuration Generator 55 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Default
Stop Container (ctrl+d)
Restart container: ./bin/karaf
Fragments are now resolved:
karaf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name ───┼──────────┼─────┼─────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 28 │ Active │ 80 │ 4.1.2 │ Apache Karaf :: OSGi Services :: Event 52 │ Active │ 80 │ 7.2.7 │ vaadin-themes, Fragments: 54, 55, 53 53 │ Resolved │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Dashboard, Hosts: 52 54 │ Resolved │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: JMX Configuration Generator, Hosts: 52 55 │ Resolved │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Default, Hosts: 52
Restart container again, Bundles are not resolved
karaf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name ───┼───────────┼─────┼─────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 28 │ Active │ 80 │ 4.1.2 │ Apache Karaf :: OSGi Services :: Event 52 │ Active │ 80 │ 7.2.7 │ vaadin-themes 53 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Dashboard 54 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: JMX Configuration Generator 55 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Default
And again, bundle:refresh does not work:
karaf@root()> bundle:refresh karaf@root()> list START LEVEL 100 , List Threshold: 50 ID │ State │ Lvl │ Version │ Name ───┼───────────┼─────┼─────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 28 │ Active │ 80 │ 4.1.2 │ Apache Karaf :: OSGi Services :: Event 52 │ Active │ 80 │ 7.2.7 │ vaadin-themes 53 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Dashboard 54 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: JMX Configuration Generator 55 │ Installed │ 80 │ 21.0.0 │ OpenNMS :: Features :: Vaadin :: Theme :: Default