Install Apache cxf in karaf - osgi

im having some problems with an sogi-app running on karaf 3.0.8. The app has these dependencies:
dependencies {
compile 'org.apache.camel:camel-core:2.15.2'
compile 'org.apache.camel:camel-cxf:2.15.2'
compile 'org.slf4j:slf4j-api:1.7.12'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
When I try to deploy it in karaf, it says:
org.osgi.framework.BundleException: Unresolved constraint in bundle
foobar.it.osgi.status.osgi-status [863]: Unable to resolve 863.1:
missing requirement [863.1] osgi.wiring.package;
(&(osgi.wiring.package=javax.ws.rs)(version>=2.0.0)(!(version>=3.0.0)))
I tried this:
feature:repo-add mvn:org.apache.cxf.karaf/apache-cxf/3.0.4/xml/feature
feature:install cxf
I then get this error:
Error executing command: Can't install feature cxf/0.0.0:
No feature named 'jetty' with version '[7,10)' available
Hmm, any tips as to how I may install the proper package? Thanks.

I just tested CXF with karaf 3.0.8. I was able to install version 3.0.4, 3.0.10 and 3.1.6 without any problems.
I am not sure why you get the error as karaf 3.0.8 contains jetty 8. So there should be a valid feature in the range you specified.
In any case I recommend to not install cxf 3.0.4. It is quite outdated as CXF is at version 3.0.10 already in this branch. Generally you should always try to install the latest bugfix version as it might contain important fixes like security issues.

Related

Mockito-core with pitest

I have to upgrade dependencies for a module and I use pitest version 1.7.4.
When I update the mockito-core version to 4.5.0 all my tests from pitest fail with message "did not pass wihout mutation". With mockito-core 4.0.0 everything works fine.
Also, if I try to update to 4.1.0 still the same. The logging from pitest is not really helping me, I looked up to release notes for mockito-core (https://github.com/mockito/mockito/releases?page=2) but I dont have any ideas.
Did someone encounter this too?
The problem was the following: https://github.com/powermock/powermock/issues/1112
I resolved this by replacing testImplementation("org.powermock:powermock-api-mockito2:2.0.9") with testImplementation("org.powermock:powermock-api-support:2.0.9")

Hystrix and OSGI bundle

I have used org.apache.servicemix.bundles.hystrix dependency to bundle Hystrix as OSGI bundle. However, I'm facing this issue:
org.osgi.framework.BundleException: Could not resolve module: [828]
Unresolved requirement: Import-Package: com.netflix.hystrix; version="[1.5.0,2.0.0)"
Can someone help me on this?
Thanks!
The error tells you that the bundle you try to install and resolve requires a certain package and that there is no bundle that offers this package.
So in you case the package com.netflix.hystrix is missing. This means that you either do not have the hystrix bundle installed or you installed a version that does not match the version range [1.5.0,2.0.0).

Testing against multiple versions with Maven

I'm maintaining an open source project, that defines following dependency (using a version range)
<dependency>
<groupId>org.eclipse.xtend</groupId>
<artifactId>org.eclipse.xtend.lib</artifactId>
<version>[2.6.0, 2.8.0)</version>
</dependency>
Issuing mvn clean install works perfectly, using the latest version of the org.eclipse.xtend.lib allowed by the range. But I would like to also make sure, that my product works with other versions from the range, say with 2.6.0.
My question is: How can I force Maven to use some specified version of a dependency without changing my pom.xml?
I though, it could be something like this:
for version in 2.6.0 2.6.1 2.7.0 2.7.1 ; do
# NOT WORKING!!!
mvn clean install -Denforce_version_org.eclipse.xtend_org.eclipse.xtend.lib=$version
done

Apache karaf how to easily install bundle from Maven repo

I am trying out Karaf and installed some bundle X. This bundle X complains about a missing requirement: Unresolved requirements ... osgi.wiring.package; (osgi.wiring.package=org.apache.commons.httpclient)]
Hence, I tried to provide the org.apache.commons.httpclient through bundle:install mvn:commons-httpclient/commons-httpclient/3.1 which worked.
But, after trying to start the X again, I still get the same error message.
thanks!
That jar is not a bundle, hence can't be deployed to karaf, it's just ignored.
Try
karaf#root>bundle:install -s mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-httpclient/3.1_7
Make it sure that your bundle has in their META-INF/MANIFEST.MF the osgi import declarations syntax. I assume that you use bndtools to generate the bundle.
Agree with #Antonio, for third party libraries which are not OSGi bundles you can also try to install them with wrap:
bundle:install -s wrap:mvn:commons-httpclient/commons-httpclient/3.1
This will create a basic OSGi MANIFEST for the library...
You can find more info here: http://karaf.apache.org/manual/latest/developers-guide/creating-bundles.html

Error building hadoop 1.0.1 - missing pom.xml

I followed the instructions given here to download and build hadoop 1.0.1 from this repository. I have installed JDK, Maven, cmake, autoconf etc. When I run th efollowing command from the hadoop top level directory
mvn -e package -Pdist -Pdoc -Psrc -Dtar -DskipTests
mvn reports an error saying that no pom.xml is found. There is no pom.xml file in the folder or any subfolders.
As far as I investigate the Hadoop Common tags, only version 0.23.x and 2.0.x is a Maven project. The rest is an Ant and/or Ivy project. Please note If there is no pom.xml it is not a Maven project.
If you would like to build the version 1.0.1, please use Apache Ant or Apache Ivy instead.

Resources