Search code examples
apache-camelapache-karafapache-commons-dbcp

Importing Apache Commons dbcp2 in Apache Karaf


I have imported my Apache Camel blueprint xml bundle into Apache Karaf. When I try to start the bundle, it is complaining about dbcp2. I've tried to bundle it into my Apache Karaf but still no luck. The error I am getting:

Error executing command: Error executing command on bundles:
    Error starting bundle 129: Unable to resolve xxx.yyy [129](R 129.0): missing 
requirement [xxx.yyy [129](R 129.0)] osgi.wiring.package; (& 
(osgi.wiring.package=org.apache.commons.dbcp2)(version>=2.9.0)(!(version>=3.0.0))) 
[caused by: Unable to resolve org.apache.commons.commons-dbcp2 [119](R 119.0): missing 
requirement [org.apache.commons.commons-dbcp2 [119](R 119.0)] osgi.wiring.package; (& 
(osgi.wiring.package=javax.transaction)(version>=1.1.0))] Unresolved requirements: 
[[xxx.yyy [129](R 129.0)] osgi.wiring.package; (& 
(osgi.wiring.package=org.apache.commons.dbcp2)(version>=2.9.0)(!(version>=3.0.0)))]

I am not sure if the problem is the dbcp2 or the javax.transaction.

I've bundled both into my Apache Karaf therefore as shown here:

119 │ Installed │  80 │ 2.9.0          │ Apache Commons DBCP
120 │ Resolved  │  80 │ 20220320.0.0   │ JSON in Java
129 │ Installed │  80 │ 0.0.1.SNAPSHOT │ Route for xxxxx (my bundle)
131 │ Resolved  │  80 │ 0              │ wrap_mvn_javax.transaction_jta_1.1

My pom file in my bundle imports dbcp2 as shown here:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-dbcp2</artifactId>
    <version>2.9.0</version>
</dependency>

Solution

  • After trying out a bit of different bundles,

    I've found out that bundle:install transaction fixed it.