pax-exam (v2.5) - fails to deploy camel-xstream - osgi

I am trying to understand/get a working example of PAX-EXAM. From my understanding, i need to deploy the bundle i want to test (in this case, boohoo-esb-common) and any bundles that it uses (in this case, camel-xstream).
However, when i try to run the test, pax-exam/felix fails to deploy the xstream feature. Below is the error i get in my console window when doing a: mvn clean install
ERROR: Bundle com.boohoo.boohoo-esb-common [25] Error starting file:/C:/Users/GARETH~1.HEA/AppData/Local/Temp/1346170773171-0/bundles/com.boohoo.boohoo-esb-common_1.0.0.SNAPSHOT.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle com.boohoo.boohoo-esb-common [25]: Unable to resolve 25.0: missing requirement [25.0] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.blueprint)(version>=1.0.0)(!(version>=2.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle com.boohoo.boohoo-esb-common [25]: Unable to resolve 25.0: missing requirement [25.0] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.blueprint)(version>=1.0.0)(!(version>=2.0.0)))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
at java.lang.Thread.run(Thread.java:662)
I've attached a simple example which should hopefully show what i mean.
Am i going about this in the right way? or am i not getting how to use pax-exam...

Your understanding is correct (you must provision all bundles you bundle-under-test requires), your execution is not :) You are still missing bundles. Apparently your bundle boohoo-esb-common requires a Blueprint Container.

Related

Android resource compilation failed - resource file not found

I'm trying to assemble an Android app in Bamboo server, but I'm getting this error when the assemble comand run. Note: It works perfectly in local.
Command running:
gradlew assembleDebug
And the error I get:
Caused by: org.gradle.internal.UncheckedException: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\aa6199e981580f79dc21c6ea06a3575f\res\drawable-mdpi-v4\quantum_ic_skip_next_white_24.png: error: file not found.
I've checked for the resource and its use, but it's not from my project code. It belongs to an external library: play-services-cast-framework
I've been also checking other similar post, but the error can be caused for many resources reasons, so I've not found a solution.
Some solutions suggest that is a problem at some gradle plugin version, but I'm already using version 3.3.1
Any help or clue?
Thanks!

how to change osgi bundle status from installed to active?

I created a maven project in eclipse and installed the bundle in osgi console but the bundle is in Installed state. All the dependencies are reolved and there are no errors but still status is not active.
How to call the OSGI service from my AEM component page. Can i invoke the osgi service from my component jsp page only if bundle state is "active"? Do i need a ServiceID to be generated for my bundle for invoking the service.
Try this -
Tail your error logs
On browser goto /system/console/bundles
Search for you bundle and try activating it manually (use the play button on right side of bundle entry)
If bundle is active successfully then possibly u need to fix you deploy script so it starts the bundle after installing
If bundle still doesn't start, look at the logs. There could be possible wiring issue or in case you have activator class for bundle its throwing exception while activating the bundle
Please go to felix console and activate the bundle using play button .
If still it doesn't get activated,expand the bundle there will be some error in the bundle(it will be shown in red).
So you need to resolve the class where the error is shown.
I hope this is helpful.
Thanks.

Package javax.smartcardio as an OSGI Bundle

I am building an Karaf OSGI application which uses javax.smartcardio library. when I deploy it, it is giving me the following error:
Unable to resolve 249.0: missing requirement [249.0] osgi.wiring.package; (osgi.wiring.package=javax.smartcardio)
at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:488)[26:org.apache.karaf.features.core:2.3.2]
at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeature(FeaturesServiceImpl.java:402)[26:org.apache.karaf.features.core:2.3.2]
at Proxy532dee57_5493_41af_a3a1_bf689277fb5b.installFeature(Unknown Source)[:]
at org.apache.karaf.deployer.kar.KarArtifactInstaller.installFeatures(KarArtifactInstaller.java:189)[24:org.apache.karaf.deployer.kar:2.3.2]
at org.apache.karaf.deployer.kar.KarArtifactInstaller.install(KarArtifactInstaller.java:134)[24:org.apache.karaf.deployer.kar:2.3.2]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:929)[6:org.apache.felix.fileinstall:3.2.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:857)[6:org.apache.felix.fileinstall:3.2.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:483)[6:org.apache.felix.fileinstall:3.2.6]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)[6:org.apache.felix.fileinstall:3.2.6]
Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle com.isirona.drivers.neuroptics-npi200.core [249]: Unable to resolve 249.0: missing requirement [249.0] osgi.wiring.package; (osgi.wiring.package=javax.smartcardio)
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826)[org.apache.felix.framework-4.0.3.jar:]
at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)[org.apache.felix.framework-4.0.3.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)[org.apache.felix.framework-4.0.3.jar:]
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:931)[org.apache.felix.framework-4.0.3.jar:]
at org.apache.karaf.features.internal.FeaturesServiceImpl.installFeatures(FeaturesServiceImpl.java:485)[26:org.apache.karaf.features.core:2.3.2]
I want to package javax.smartcardio library as a bundle. There are links on how to build a bundle from .jar but I cannot find javax.smartcardio library in my JDK.
Is it inside the JDK? Do I have to do anything special to get access to it. Thank you.
If it's part of the JDK make sure you export it as a system package.
For this edit the etc/jre.properties file.
You'll need to add the corresponding package to the section of the JVM you use. And usually it's also best to export it with a correct version if known.

Unable to auto-deploy bundle to Karaf

I am developing an OSGI-based application, which deploys to Karaf container. Karaf has an auto-deployment feature, whereby copying a bundle to its karaf/deploy directory should automatically deploy that bundle into the container. More often than not, however, I am getting errors similar to the one below when I copy bundles into the deploy directory:
org.osgi.framework.BundleException: Bundle symbolic name and version are not unique: legacy-services-impl:8.0.0.ALPHA-SPRINT9-SNAPSHOT
at org.apache.felix.framework.BundleImpl.createRevision(BundleImpl.java:1225)
at org.apache.felix.framework.BundleImpl.<init>(BundleImpl.java:95)
at org.apache.felix.framework.Felix.installBundle(Felix.java:2979)
at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.installOrUpdateBundle(DirectoryWatcher.java:1030)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:944)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:857)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:483)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)[6:org.apache.felix.fileinstall:3.3.11.fuse-71-047]
Instead of redeploying an already deployed bundle, the container tells me that I am trying to deploy a duplicate bundle.
The Karaf indeed has that bundle deployed, but why wouldn't it redeploy the bundle? What is causing this behavior? How to avoid such errors on auto-deploy?
Thank you,
Michael
I suspect that your bundle does not stop correctly. That may be the reason why karaf thinks it is still there. Do you have some code in your activator that is executed when stopping? Perhaps you are also running some threads. You should make sure the stop method of your activator works and cleanly closes all resources and stops all threads of your bundle.

Finding unsatisfied bundle constraints from Karaf console

How can I find unsatisfied constraints of a bundle which didn't start from Apache Karaf console? I.e. what is its equivalent of Equinox's diag command?
Which version of Karaf are you using? The following should be relevant to Karaf 2.x
Annoyingly the package:imports/package:exports commands only work on a bundle in the STARTED state.
If the bundle is only INSTALLED you can use: headers ${BUNDLE NUMBER} will highlight any missing imports in red.
Also trying to start a bundle should print to the console any unresolved constraints as an LDAP filter expression.

Resources