0

I have created an OSGi bundle, that is using apache commons dbcp2 to create a database connection pool. I am using apache felix gogo as runtime to start my bundles. I have loaded multiple other external libraries without any problems into the apache felix:

Image here (cant post no rep): https://i.gyazo.com/c779ccaba20e3fa327d61a621748d8dc.png

However every time I try to start dbcp2 bundle which is requiered in my bundle I get the following error:

Image here (cant post no rep): https://i.gyazo.com/ac7b673e63b9e6ad764af2e6adddb19a.png

I have found that there is some Apache mixservice bundle available, but it contains dbcp 1.4 and I need dbcp 2.5.0 or higher.

What needs to be done so apache felix is able to load the dbcp2 as a library requiered by other projects ?

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
Dakado
  • 11
  • 2
  • 6
  • Instead of an image you should better upload such an error message into paste bin or a similar service for text content. That makes it easier to copy a part of it to reference the error in the answer. – Christian Schneider Oct 06 '19 at 11:20

1 Answers1

0

What you see in the error is that the dbcp bundle requires the javax.transaction package in version >= 1.1.0. This is not an error in the bundle. It just means that you need to provide this package in the OSGi container.

Normally you would install a bundle that provides the package. In this case the package comes from the jre and the system bundle should export it.

Depending on how you start felix the way to export a system package is different. For example if you use bndtools you do this in a bndrun file. See the Enroute microsevice example.

For plain felix see the parameter "org.osgi.framework.system.packages.extra".

In this example the javax.transaction package is exported (among some others).

Christian Schneider
  • 19,420
  • 2
  • 39
  • 64