Search code examples
mavenapache-camelosgiapache-karafkaraf

Could not start bundle Unresolved constraint in bundle osgi.wiring.package=org.apache.commons.configuration version>=1.9.0 ! version>=2.0.0


I am trying to install a latest version of my apache camel application using feature:install on Karaf this new version has a dependency of org.apache.commons.configuration ver 1.9 but getting the below error

error:

Error executing command: Could not start bundle mvn: in feature(s)<package> : Unresolved constraint in bundle <bundle> [414]: Unable to resolve 414.0: missing requirement [414.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.configuration)(version>=1.9.0)(!(version>=2.0.0)))

I had included it in the pom.xml

<dependency>
        <groupId>commons-configuration</groupId>
        <artifactId>commons-configuration</artifactId>
        <version>1.9</version>
    </dependency>

also have tried several ways suggested in sof but none is working

have also put the for org.apache.commons.configuration under the plugins

        <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Import-Package>
                        org.apache.cxf.service.model,
                        org.apache.cxf.message,
                        org.apache.commons.configuration,
                        *
                    </Import-Package>
                </instructions>
            </configuration>
        </plugin>

But still not able to resolve. Could anyone please help resolve this?

thanks


Solution

  • You need to ensure that the jar is installed in Karaf. In order to do this you need to wrap the jar as a bundle:

    osgi:install wrap:mvn:commons-configuration/commons-configuration/1.9

    After you've done this make sure to remove the addition you made to Import-Package as it's not needed.

    If you want the dependency to be installed along with your application's feature just add the following element to your feature:

    <bundle>wrap:mvn:commons-configuration/commons-configuration/1.9</bundle>