Unable to load bundle in Karaf - maven

I’m following this tutorial https://wiki.onosproject.org/display/ONOS/Template+Application+Tutorial for creating a CLI command that allows me to block an OF switch’s interface throught intent. I built ONOS using Bazel as suggested here https://wiki.onosproject.org/display/ONOS/Developer+Quick+Start and everything has gone well, even the creation and installation of the template application into ONOS. Now in the java class AppCommand I imported the package org.onosproject.openflow.controller.OpenFlowController, adding in the pom.xml file the dependency with artifactID and groupID onos-of-api-1.6.0 and when I reinstall the application this error is thrown:
Unable to perform operation on application org.foo.app
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=foo-app; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=foo-app)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve foo-app/1.0.0.SNAPSHOT: missing requirement [foo-app/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=org.foo.foo-app; type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; resolution:=mandatory [caused by: Unable to resolve org.foo.foo-app/1.0.0.SNAPSHOT: missing requirement [org.foo.foo-app/1.0.0.SNAPSHOT] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.onosproject.openflow.controller)(version>=1.6.0)(!(version>=2.0.0)))"]]
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?]
at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392) ~[?:?]
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378) ~[?:?]
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332) ~[?:?]
at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257) ~[?:?]
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:393) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1062) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:998) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
It seems that there is a problem with the version of the dependency but I don’t understand why.
Thanks a lot for you attention.

The error message you’re getting from Karaf suggests that you have a dependency which isn’t satisfied. this often happens when you have a dependency which doesn’t have (or has incorrect) OSGi metadata in the MANIFEST.MF file. You should open it up and determine if the build system you’ve used has included it, and if so, whether or not the dependencies are present are also OSGi-ified bundles.
In this case, check to see if the Jar that has the org.onosproject.openflow.controller is an OSGi bundle — it doesn’t look like it is.

Related

feature:install fails and returns "Unable to resolve root" message

I have downloaded and uncompressed OpenDayLight's Sulfur release (I have tested Tar and Zip versions with the same results). I ran bin/karaf and it started correctly. Then I tried to install a feature, specifically "feature:install odl-mdsal-distributed-datastore" and I get the following error message (long):
Error executing command: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=odl-mdsal-distributed-datastore; type=karaf.feature; version="[5.0.5,5.0.5]"; filter:="(&(osgi.identity=odl-mdsal-distributed-datastore)(type=karaf.feature)(version>=5.0.5)(version<=5.0.5))" [caused by: Unable to resolve odl-mdsal-distributed-datastore/5.0.5: missing requirement [odl-mdsal-distributed-datastore/5.0.5] osgi.identity; osgi.identity=org.opendaylight.controller.sal-distributed-datastore; type=osgi.bundle; version="[5.0.5,5.0.5]"; resolution:=mandatory [caused by: Unable to resolve org.opendaylight.controller.sal-distributed-datastore/5.0.5: missing requirement [org.opendaylight.controller.sal-distributed-datastore/5.0.5] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.opendaylight.mdsal.dom.broker)(version>=9.0.0)(!(version>=10.0.0)))" [caused by: Unable to resolve org.opendaylight.mdsal.dom-broker/9.0.4: missing requirement [org.opendaylight.mdsal.dom-broker/9.0.4] osgi.service; filter:="(objectClass=org.opendaylight.mdsal.dom.api.DOMSchemaService)"; effective:=active [caused by: Unable to resolve org.opendaylight.mdsal.dom-schema-osgi/9.0.4: missing requirement [org.opendaylight.mdsal.dom-schema-osgi/9.0.4] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.opendaylight.mdsal.binding.runtime.spi)(version>=9.0.0)(!(version>=10.0.0)))" [caused by: Unable to resolve org.opendaylight.mdsal.binding-runtime-spi/9.0.4: missing requirement [org.opendaylight.mdsal.binding-runtime-spi/9.0.4] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.opendaylight.mdsal.binding.runtime.api)(version>=9.0.0)(!(version>=10.0.0)))" [caused by: Unable to resolve org.opendaylight.mdsal.binding-runtime-api/9.0.4: missing requirement [org.opendaylight.mdsal.binding-runtime-api/9.0.4] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.opendaylight.mdsal.binding.model.api)(version>=9.0.0)(!(version>=10.0.0)))" [caused by: Unable to resolve org.opendaylight.mdsal.binding-model-api/9.0.4: missing requirement [org.opendaylight.mdsal.binding-model-api/9.0.4] osgi.identity; osgi.identity="root#odl-mdsal-binding-runtime-api-9.0.4"; type=karaf.subsystem; version="[0,0.0.0]"; resolution:=mandatory [caused by: Unable to resolve root#odl-mdsal-binding-runtime-api-9.0.4: missing requirement [root#odl-mdsal-binding-runtime-api-9.0.4] osgi.identity; osgi.identity=odl-mdsal-binding-runtime-api; type=karaf.feature; version="[9.0.4,9.0.4]" [caused by: Unable to resolve odl-mdsal-binding-runtime-api/9.0.4: missing requirement [odl-mdsal-binding-runtime-api/9.0.4] osgi.identity; osgi.identity=odl-yangtools-parser; type=karaf.feature; version="[8.0.0,9.0.0)" [caused by: Unable to resolve odl-yangtools-parser/8.0.6: missing requirement [odl-yangtools-parser/8.0.6] osgi.identity; osgi.identity=odl-yangtools-xpath; type=karaf.feature; version="[8.0.6,8.0.6]" [caused by: Unable to resolve odl-yangtools-xpath/8.0.6: missing requirement [odl-yangtools-xpath/8.0.6] osgi.identity; osgi.identity=yang-xpath-impl; type=osgi.bundle; version="[8.0.6,8.0.6]"; resolution:=mandatory [caused by: Unable to resolve yang-xpath-impl/8.0.6: missing requirement [yang-xpath-impl/8.0.6] osgi.wiring.package; filter:="(osgi.wiring.package=javax.inject)"]]]]]]]]]]]]
I have tried installing other features with similar results.
However, I downloaded OpenDayLight's Phosphorus, Zip version, tried to install the same feature, and it ran successfully.
Does anyone know why feature:install fails in Sulfur but runs OK in Phosphorus?

What depends on netty-tcnative in Quarkus?

This pertains to a GitHub issue where TensorFlow is being loaded at runtime for native image:
https://github.com/awslabs/djl/issues/103#issuecomment-658549779
It causes a io.netty.internal.tcnative.SSLPrivateKeyMethod class not found error during native image compilation. If I add this dependency, the error goes away:
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>2.0.31.Final</version>
</dependency>
Here is the stack trace:
Fatal error:java.lang.NoClassDefFoundError
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:463)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:359)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:518)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:117)
at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:546)
Caused by: java.lang.NoClassDefFoundError: io/netty/internal/tcnative/SSLPrivateKeyMethod
at jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVM.getDeclaredMethods(Native Method)
at jdk.internal.vm.ci/jdk.vm.ci.hotspot.HotSpotResolvedObjectTypeImpl.getDeclaredMethods(HotSpotResolvedObjectTypeImpl.java:958)
at com.oracle.svm.jni.access.JNIAccessibleMethod.anyMatchIgnoreReturnType(JNIAccessibleMethod.java:139)
at com.oracle.svm.jni.access.JNIAccessibleMember.findHidingSubclasses(JNIAccessibleMember.java:103)
at com.oracle.svm.jni.access.JNIAccessibleMember.findHidingSubclasses(JNIAccessibleMember.java:110)
at com.oracle.svm.jni.access.JNIAccessibleMember.setHidingSubclasses(JNIAccessibleMember.java:83)
at com.oracle.svm.jni.access.JNIAccessibleMethod.finishBeforeCompilation(JNIAccessibleMethod.java:135)
at com.oracle.svm.jni.access.JNIAccessFeature.beforeCompilation(JNIAccessFeature.java:348)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$doRun$2(NativeImageGenerator.java:595)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:595)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:451)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Caused by: java.lang.ClassNotFoundException: io.netty.internal.tcnative.SSLPrivateKeyMethod
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 18 more
It is definitely related to one of the following configs, and does also seem to be impacted by JNI, but I am not sure how.
quarkus.native.enable-jni=true
quarkus.ssl.native=true
quarkus.native.additional-build-args=--initialize-at-run-time=org.tensorflow\\,ai.djl\\,org.bytedeco
In searching through the Quarkus GitHub repos, I cannot find reference to netty-tcnative. I really do not understand why this is needed as it seems to be related to Tomcat?
In order to fix this problem, or file a GitHub issue, need to understand where this dependency is expected.

Unable to deploy a Karaf kar file containing a ComponentFactory OSGi declarative service

I'm having hard time to get a simple PoC application to work in Karaf 4.2.1 and 4.0.9 (ServiceMix - 7.0.1).
The application tries to create services using a org.osgi.service.component.ComponentFactory but during deployment time via Karaf's feature file format I get the following error:
15:27:07.969 WARN [fileinstall-/Users/tmoreira2020/temp/apache-karaf-4.2.1/deploy] Unable to install Kar feature br.com.thiagomoreira.application/1.0.0.SNAPSHOT
org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=br.com.thiagomoreira.application; type=karaf.feature; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=br.com.thiagomoreira.application)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))" [caused by: Unable to resolve br.com.thiagomoreira.application/1.0.0.SNAPSHOT: missing requirement [br.com.thiagomoreira.application/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=br.com.thiagomoreira.application; type=osgi.bundle; version="[1.0.0.201808301826,1.0.0.201808301826]"; resolution:=mandatory [caused by: Unable to resolve br.com.thiagomoreira.application/1.0.0.201808301826: missing requirement [br.com.thiagomoreira.application/1.0.0.201808301826] osgi.service; filter:="(objectClass=org.osgi.service.component.ComponentFactory)"; effective:=active]]
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?]
at org.apache.felix.resolver.ResolverImpl.doResolve(ResolverImpl.java:392) ~[?:?]
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:378) ~[?:?]
at org.apache.felix.resolver.ResolverImpl.resolve(ResolverImpl.java:332) ~[?:?]
at org.apache.karaf.features.internal.region.SubsystemResolver.resolve(SubsystemResolver.java:257) ~[?:?]
at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:388) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1025) ~[?:?]
at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:964) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:?]
at java.lang.Thread.run(Thread.java:748) ~[?:?]
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve br.com.thiagomoreira.application/1.0.0.SNAPSHOT: missing requirement [br.com.thiagomoreira.application/1.0.0.SNAPSHOT] osgi.identity; osgi.identity=br.com.thiagomoreira.application; type=osgi.bundle; version="[1.0.0.201808301826,1.0.0.201808301826]"; resolution:=mandatory [caused by: Unable to resolve br.com.thiagomoreira.application/1.0.0.201808301826: missing requirement [br.com.thiagomoreira.application/1.0.0.201808301826] osgi.service; filter:="(objectClass=org.osgi.service.component.ComponentFactory)"; effective:=active]
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?]
... 12 more
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve br.com.thiagomoreira.application/1.0.0.201808301826: missing requirement [br.com.thiagomoreira.application/1.0.0.201808301826] osgi.service; filter:="(objectClass=org.osgi.service.component.ComponentFactory)"; effective:=active
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?]
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1343) ~[?:?]
... 12 more
If I deploy the bundles independently, e.g. one after another without the kar file, the wiring process works well.
The project's code is available at https://github.com/tmoreira2020/poc-osgi-whiteboard
What I'm missing?

error installling feature Opendaylight Oxygen release?

I downloaded the pre-build ".tar" version of Open-daylight Oxygen release. When I try to install the dlux feature using feature:install command, I get the following error.
dluxapps-topology error:
Error executing command: Exception in org.opendaylight.controller.config.manager.impl.osgi.ConfigManagerActivator.stop() of bundle org.opendaylight.controller.config-manager.
dluxapps-application error:
19:32:19.530 [Refresh Thread: Equinox Container: d3f0af16-e328-4ecd-927f-ddb53597d0d5] ERROR org.opendaylight.controller.config.manager.impl.osgi.ConfigManagerActivator - Error starting config manager
java.lang.IllegalStateException: BundleContext is no longer valid
at org.eclipse.osgi.internal.framework.BundleContextImpl.checkValid(BundleContextImpl.java:984) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:463) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:482) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.registerService(BundleContextImpl.java:999) [?:?]
at org.opendaylight.controller.config.manager.impl.osgi.mapping.RefreshingSCPModuleInfoRegistry.<init>(RefreshingSCPModuleInfoRegistry.java:47) [112:org.opendaylight.controller.config-manager:0.8.0]
at org.opendaylight.controller.config.manager.impl.osgi.ConfigManagerActivator.start(ConfigManagerActivator.java:61) [112:org.opendaylight.controller.config-manager:0.8.0]
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:774) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1) [?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:767) [?:?]
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:724) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932) [?:?]
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309) [?:?]
at org.eclipse.osgi.container.Module.doStart(Module.java:581) [?:?]
at org.eclipse.osgi.container.Module.start(Module.java:449) [?:?]
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:470) [?:?]
at org.eclipse.osgi.container.ModuleContainer.start(ModuleContainer.java:736) [?:?]
at org.eclipse.osgi.container.ModuleContainer.applyDelta(ModuleContainer.java:727) [?:?]
at org.eclipse.osgi.container.ModuleContainer.resolveAndApply(ModuleContainer.java:497) [?:?]
at org.eclipse.osgi.container.ModuleContainer.resolve(ModuleContainer.java:443) [?:?]
at org.eclipse.osgi.container.ModuleContainer.refresh(ModuleContainer.java:987) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1368) [?:?]
at org.eclipse.osgi.container.ModuleContainer$ContainerWiring.dispatchEvent(ModuleContainer.java:1) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) [?:?]
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) [?:?]
19:32:19.580 [Blueprint Extender: 1] ERROR io.netty.util.ResourceLeakDetector - LEAK: HashedWheelTimer.release() was not called before it's garbage-collected. Enable advanced leak reporting to find out where the leak occurred. To enable advanced leak reporting, specify the JVM option '-Dio.netty.leakDetection.level=advanced' or call ResourceLeakDetector.setLevel() See http://netty.io/wiki/reference-counted-objects.html for more information.
The DLUX subproject in ODL currently is no longer actively maintained by anyone. It was therefore actually removed in the current dev release cycle (current master, upcoming Fluorine). It's not suprising to see that it actually was already broken in Oxygen. If you / your organization has an active interest in DLUX, you would most probably be very welcome to step as the new active maintainer to fix it and keep it up to date... ;-)

org.apache.aries.transaction.blueprint/1.1.1 can't get javax.transaction.TransactionManager

I've created maven distribution using karaf-maven-plugin.
I've created maven project using
mvn archetype:generate -DarchetypeGroupId=org.apache.karaf.archetypes
-DarchetypeArtifactId=karaf-assembly-archetype -DarchetypeVersion=4.1.0
then I've added following features:
<bootFeatures>
<feature>standard</feature>
<feature>jpa/2.5.0</feature>
<feature>transaction-api/1.2.0</feature>
<feature>transaction</feature>
<feature>eclipselink</feature>
<feature>pax-jdbc-config</feature>
<feature>pax-jdbc-postgresql</feature>
</bootFeatures>
When I download karaf 4.1.0 distribution from Apache site, and install features using feature:install, everything works fine, however, in the distribution built by plugin I get the error:
Unable to start blueprint container for bundle
org.apache.aries.transaction.blueprint/1.1.1 due to unresolved
dependencies [(objectClass=javax.transaction.TransactionManager)]
java.util.concurrent.TimeoutException at
org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:371)
[15:org.apache.aries.blueprint.core:1.7.1] at
org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
[15:org.apache.aries.blueprint.core:1.7.1] at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[?:?] at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[?:?] at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[?:?] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[?:?] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[?:?] at java.lang.Thread.run(Thread.java:745) [?:?]
2017-03-22T11:03:51,401 | ERROR | Blueprint Extender: 1 |
BlueprintContainerImpl | 15 -
org.apache.aries.blueprint.core - 1.7.1 | Unable to start blueprint
container for bundle org.apache.aries.transaction.blueprint/2.1.0 due
to unresolved dependencies
[(objectClass=javax.transaction.TransactionManager)]
java.util.concurrent.TimeoutException at
org.apache.aries.blueprint.container.BlueprintContainerImpl$1.run(BlueprintContainerImpl.java:371)
[15:org.apache.aries.blueprint.core:1.7.1] at
org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)
[15:org.apache.aries.blueprint.core:1.7.1] at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[?:?] at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
[?:?] at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
[?:?] at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[?:?] at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[?:?] at java.lang.Thread.run(Thread.java:745) [?:?]
I've found the service in OSGi registry in web console:
Service 266 - [org.apache.aries.transaction.AriesTransactionManager, javax.transaction.TransactionManager, javax.transaction.TransactionSynchronizationRegistry, javax.transaction.UserTransaction, org.apache.geronimo.transaction.manager.RecoverableTransactionManager] (pid: n/a)
from Bundle 143 - Apache Aries Transaction Manager (org.apache.aries.transaction.manager), version 1.3.2
service.bundleid: 143
service.scope: singleton
What is wrong here? Do maven plugin do something wrong, or the problem is, that plugin uses instable version of artifacts?
Without looking at the wiring of your OSGi bundles it's not possible to be certain, but the most likely explanation is down to the toxic javax.transaction package. When specifying JTA it became clear that certain types in "core Java" needed to implement certain JTA interfaces, for example SQL Connection objects need a related XAResource. This forced some of the JTA API into core Java, but rather than putting the complete API into the base runtime only a few types were added. This leads to a split package between the Java Runtime and JTA, and causes big problems in modular systems (which don't normally allow you to see the same package from multiple sources simultaneously.
In this case the Transaction Manager service must be using the JTA API from a bundle deployed inside the OSGi framework (the base runtime doesn't include the TransactionManager interface). The consuming bundle, on the other hand, is probably importing javax.transaction from the system bundle (i.e. the Java runtime). As these two bundles don't share a view of the service API they then cannot share the OSGi service.
The only real way to fix this is by putting the JTA API on the Java classpath and exposing it through the system bundle at the correct version using a launch property such as:
org.osgi.framework.system.packages.extra=javax.transaction;version=1.2

Resources