Community
Participate
Working Groups
Build Identifier: 3.6 M6 In our Java EE environment we have a bundle that exports javax.transaction package and contains the EE implementation classes - such as UserTransaction. This bundle exports the package at a version higher than 0.0.0 (which is the version number that the system bundle uses for the JDK's implementation). That package is also defined in Java SE 6, but does not contain classes from Java EE. For bundles that use the "DynamicImport-Package: *" attribute, they are resolved to the system bundle which cannot find the Java EE classes even though the system bundle exports the javax.transaction package at a lowmer version number than our bundle. Tom W. mentioned that this was due to bug 138422. This new behavior (post-138422) seems incorrect according to the OSGi spec - but nevertheless, it would be nice if this behavior were configurable via the config.ini file. Reproducible: Always Steps to Reproduce: 1. Create a bundle (in our case, javax.j2ee.jta) that exports package javax.transaction at version "6.0.0" and contains class javax.transaction.UserTransaction. 2. Create a second bundle that imports the javax.transaction package without specifying a version (in our environment, we use "DynamicImport-Package: *"). 3. Attempt to load the javax.transaction.UserTransaction class from the second bundle -- should fail with a NoClassDefFoundError.
I am willing to add a configuration, but if you have a bundle that needs a particular version of a package then you better make sure you have matching attributes that ensure you get what you need. The framework is free to wire you up to any export which it views matches a particular package constraint. Even if we have an option that does not prefer the system packages you may still find your bundles getting wired to the wrong version.
Created attachment 168404 [details] patch
DJ please review.
Andrew, please review.
Tom, Thanks for the quick response! My initial sniff test of the patch passed when setting osgi.resolver.preferSystemPackages=false in the config.ini. I have kicked off a larger batch of automated tests and will let you know the results. Thanks again, Andy
Patch released for RC2.
*** Bug 329314 has been marked as a duplicate of this bug. ***