Clearly, I used the “hibernate-validator-osgi-karaf-features” name because I
was under the mistaken impression that the file name represented the feature
name.
However, after changing that feature name reference, I’m now getting a
different but related error:
org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing
requirement [root] osgi.identity; osgi.identity=usl-fraudcheck;
type=karaf.feature; version="[2.5.0.SNAPSHOT,2.5.0.SNAPSHOT]";
filter:="(&(osgi.identity=usl-fraudcheck)(type=karaf.feature)(version>=2.5.0.SNAPSHOT)(version<=2.5.0.SNAPSHOT))"
[caused by: Unable to resolve usl-fraudcheck/2.5.0.SNAPSHOT: missing
requirement [usl-fraudcheck/2.5.0.SNAPSHOT] osgi.identity;
osgi.identity=com.att.detsusl.usl-fraudcheck-api; type=osgi.bundle;
version="[2.5.0.SNAPSHOT,2.5.0.SNAPSHOT]"; resolution:=mandatory [caused by:
Unable to resolve com.att.detsusl.usl-fraudcheck-api/2.5.0.SNAPSHOT: missing
requirement [com.att.detsusl.usl-fraudcheck-api/2.5.0.SNAPSHOT]
osgi.wiring.package;
filter:="(&(osgi.wiring.package=javax.validation)(version>=1.1.0)(!(version>=2.0.0)))"]]
I find it a little hard to interpret these “missing requirement” errors. Is
this telling me that it’s unable to find the “javax.validation” bundle?
The module that my test is in has a features file that defines a
“usl-fraudcheck” feature, which references the “usl-base” feature, which I’ve
mentioned earlier references the “hibernate-validator-osgi-features” feature
(hopefully the correct name now). The first features file also has the
following two bundle references:
<bundle>mvn:com.att.detsusl/usl-fraudcheck-api/${pom.version}</bundle>
<bundle>mvn:com.att.detsusl/usl-fraudcheck-impl/${pom.version}</bundle>
Note that usl-fraudcheck-impl is the module that this features file is
contained within (this seems odd, but I didn’t write this). Also note that the
“usl-fraudcheck-api” module does NOT have a features file, which seems wrong to
me.
From: Achim Nierbeck [mailto:[email protected]]
Sent: Monday, June 05, 2017 10:52 AM
To: [email protected]
Subject: Re: PaxExam test using hibernate validator can't find validator
Hi,
I'm not sure I follow.
in the feature file I only see one feature which matches your criteria ...
it's:
hibernate-validator
see also this file:
https://repo1.maven.org/maven2/org/hibernate/hibernate-validator-osgi-karaf-features/5.4.1.Final/hibernate-validator-osgi-karaf-features-5.4.1.Final-features.xml<https://urldefense.proofpoint.com/v2/url?u=https-3A__repo1.maven.org_maven2_org_hibernate_hibernate-2Dvalidator-2Dosgi-2Dkaraf-2Dfeatures_5.4.1.Final_hibernate-2Dvalidator-2Dosgi-2Dkaraf-2Dfeatures-2D5.4.1.Final-2Dfeatures.xml&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=PGdpdzVRN8c5pV9ASiGYH9Cb1WRVtjdTEd7TETl5jpQ&e=>
So I don't understand where you got that name from:
hibernate-validator-osgi-karaf-features
that is only the name of the feature file, which doesn't mean the main feature
of that file needs to be the same :)
regards, Achim
2017-06-05 19:22 GMT+02:00 KARR, DAVID <[email protected]<mailto:[email protected]>>:
Ok, makes sense, but it still isn’t quite there yet.
In the features file in a module called “usl-base”, I added the following
repository definition next to a couple of existing ones:
<repository>mvn:org.hibernate/hibernate-validator-osgi-karaf-features/5.4.1.Final/xml/features</repository>
In the “usl-base” feature in that features file, I added the following
reference:
<feature>hibernate-validator-osgi-karaf-features</feature>
Looking at the actual features file that is referenced here, I noticed that I
had some redundant bundle references in this features file, so I removed them
(“hibernate-validator”, “classmate”, et cetera).
I then installed this features file, and then reran my test, and the karaf
startup failed with this:
org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing
requirement [root] osgi.identity; osgi.identity=usl-fraudcheck;
type=karaf.feature; version="[2.5.0.SNAPSHOT,2.5.0.SNAPSHOT]";
filter:="(&(osgi.identity=usl-fraudcheck)(type=karaf.feature)(version>=2.5.0.SNAPSHOT)(version<=2.5.0.SNAPSHOT))"
[caused by: Unable to resolve usl-fraudcheck/2.5.0.SNAPSHOT: missing
requirement
[usl-fraudcheck/2.5.0.<https://urldefense.proofpoint.com/v2/url?u=http-3A__2.5.0.&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=EKd8wFOOOGPMtVLSUVCjnrqceDzQ5sY7l9OlqwUkFh0&e=>SNAPSHOT]
osgi.identity; osgi.identity=usl-base; type=karaf.feature [caused by: Unable
to resolve usl-base/2.5.0.SNAPSHOT: missing requirement
[usl-base/2.5.0.SNAPSHOT] osgi.identity;
osgi.identity=hibernate-validator-osgi-karaf-features; type=karaf.feature]]
The “usl-fraudcheck” feature is the feature in the module with my test, which
references the “usl-base” feature. So, it seems that it couldn’t find the
“hibernate-validator-osgi-karaf-features” feature.
I then verified that the following file exists:
~/.m2/repository/org/hibernate/hibernate-validator-osgi-karaf-features/5.4.1.<https://urldefense.proofpoint.com/v2/url?u=http-3A__5.4.1.&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=7eedWhkpbVoFuObejraXLkglQbtUnuBHNez1qyOUdVQ&e=>Final/hibernate-validator-osgi-karaf-features-5.4.1.Final-features.xml
However, I found it curious that it begins with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Hibernate Validator, declare and validate application constraints
~
~ License: Apache License, Version 2.0
~ See the license.txt file in the root directory or
<http://www.apache.org/licenses/LICENSE-2.0<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.apache.org_licenses_LICENSE-2D2.0&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=glgeeTIvfmhwcTWfKtmOZQVSkouVfR_qZe47thQplyQ&e=>>.
-->
<features
xmlns="http://karaf.apache.org/xmlns/features/v1.4.0<https://urldefense.proofpoint.com/v2/url?u=http-3A__karaf.apache.org_xmlns_features_v1.4.0&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=5galb2ITF6lsXAjDEH6EnhUqG2bDB-tdE_M_r05CBCI&e=>"
name="hibernate-validator-osgi-features"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.w3.org_2001_XMLSchema-2Dinstance&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=QeQ5yb41MchDrrhTW05QuRJMfhsnTvJp3shkq5I7p1w&e=>"
xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.4.0<https://urldefense.proofpoint.com/v2/url?u=http-3A__karaf.apache.org_xmlns_features_v1.4.0&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=5galb2ITF6lsXAjDEH6EnhUqG2bDB-tdE_M_r05CBCI&e=>">
The “name” property of the top-level features element is
“hibernate-validator-osgi-features”, not
“hibernate-validator-osgi-karaf-features”. Is that a problem?
From: Achim Nierbeck
[mailto:[email protected]<mailto:[email protected]>]
Sent: Monday, June 05, 2017 9:29 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: PaxExam test using hibernate validator can't find validator
hmm ... to me this artifact:
org.hibernate:hibernate-validator-osgi-karaf-features
doesn't sound like a bundle but more like a feature.
and according to this[1], it is a feature file.
So make sure you reference the "hibernate-validator" feature in your own
feature file.
if you want to define a dependency to another feature file from your own.
make sure to have a repo definition:
<repository>mvn:org.hibernate/hibernate-validator-osgi-karaf-features/5.4.1.Final/xml/features</repository>
regards, Achim
[1] -
http://search.maven.org/#artifactdetails%7Corg.hibernate%7Chibernate-validator-osgi-karaf-features%7C5.4.1.Final%7Cpom<https://urldefense.proofpoint.com/v2/url?u=http-3A__search.maven.org_-23artifactdetails-257Corg.hibernate-257Chibernate-2Dvalidator-2Dosgi-2Dkaraf-2Dfeatures-257C5.4.1.Final-257Cpom&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=As6N5mQlxUz7ghxb25q0tzD45Uu3Qj4gCD6yGyrA-0A&e=>
[2] -
https://repo1.maven.org/maven2/org/hibernate/hibernate-validator-osgi-karaf-features/5.4.1.Final/hibernate-validator-osgi-karaf-features-5.4.1.Final-features.xml<https://urldefense.proofpoint.com/v2/url?u=https-3A__repo1.maven.org_maven2_org_hibernate_hibernate-2Dvalidator-2Dosgi-2Dkaraf-2Dfeatures_5.4.1.Final_hibernate-2Dvalidator-2Dosgi-2Dkaraf-2Dfeatures-2D5.4.1.Final-2Dfeatures.xml&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=vD7BMmrrvCLY7YOfVqPdo5onjeXnQ9q9j_AqaNEre4k&e=>
2017-06-05 17:37 GMT+02:00 KARR, DAVID <[email protected]<mailto:[email protected]>>:
I'm working on a codebase that builds a bunch of OSGi modules, and deploys to
karaf.
I'm attempting to implement javax.validation using Hibernate Validator. I was
able to get the correct Maven artifacts in order for my plain unit tests to
work.
However, when I ran my PaxExam integration test, it fails with:
"Unable to create a Configuration, because no Bean Validation provider could be
found. Add a provider like Hibernate Validator (RI) to your classpath."
After some research, I determined that I needed to use the
"hibernate-validator-osgi-karaf-features" artifact. However, this just gives
me a new error:
"Could not find artifact
org.hibernate:hibernate-validator-osgi-karaf-features:jar:5.4.1.Final in
central
(http://repo1.maven.org/maven2/<https://urldefense.proofpoint.com/v2/url?u=http-3A__repo1.maven.org_maven2_&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=JD9PqtfvfGg2L4e44x_lnFbbcv5uOTKAHptpFSRH6JQ&e=>)"
Here is an excerpt of a "features.xml" file inside the definition of a feature
that is dependent feature of the main feature in the module where my
integration test is:
----------------
<bundle
start-level="100">wrap:mvn:javax.validation/validation-api/1.1.0.Final$Bundle-Name=javax.validation&Bundle-SymbolicName=javax.validation&Bundle-Version=1.1.0.Final</bundle>
<bundle>mvn:org.hibernate/hibernate-validator/5.4.1.<https://urldefense.proofpoint.com/v2/url?u=http-3A__5.4.1.&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=d4F2HBQnG0VgS87tUYGLOJNkDsHxITy2zNwXmewTGEg&e=>Final</bundle>
<bundle>wrap:mvn:org.hibernate/hibernate-validator-osgi-karaf-features/5.4.1.<https://urldefense.proofpoint.com/v2/url?u=http-3A__5.4.1.&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=d4F2HBQnG0VgS87tUYGLOJNkDsHxITy2zNwXmewTGEg&e=>Final$Bundle-Name=hibernate-validator-osgi-karaf-features&Bundle-SymbolicName=hibernate-validator-osgi-karaf-features&Bundle-Version=5.4.1.Final</bundle>
----------------
I'm guessing that part of my problem is that this is a POM artifact, not a JAR
artifact, but I don't know what to do here.
--
Apache Member
Apache Karaf
<http://karaf.apache.org/<https://urldefense.proofpoint.com/v2/url?u=http-3A__karaf.apache.org_&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=1AtAjWo20M9NtJRfUU-xC_OLufXHR3QFhz4YiqapfDU&e=>>
Committer & PMC
OPS4J Pax Web
<http://wiki.ops4j.org/display/paxweb/Pax+Web/<https://urldefense.proofpoint.com/v2/url?u=http-3A__wiki.ops4j.org_display_paxweb_Pax-2BWeb_&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=kP1598mVzEsFMyfHm97vIafC2nNKKw352TlPDPDXDm8&e=>>
Committer & Project Lead
blog
<http://notizblog.nierbeck.de/<https://urldefense.proofpoint.com/v2/url?u=http-3A__notizblog.nierbeck.de_&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=EbG7OOlXl-TpPsxTKKNdS9bQ2zlaFOoozz2XlAQBHb8&e=>>
Co-Author of Apache Karaf Cookbook
<http://bit.ly/1ps9rkS<https://urldefense.proofpoint.com/v2/url?u=http-3A__bit.ly_1ps9rkS&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=Zh3YlwUBx9x6RHcJJm9-PgIOGVz9Sg3C5KBvKpkmjgA&s=1EGWETeRgV-rQez2jRl2EUk4X8ji64Lu-2iR9BcBgEo&e=>>
Software Architect / Project Manager / Scrum Master
--
Apache Member
Apache Karaf
<http://karaf.apache.org/<https://urldefense.proofpoint.com/v2/url?u=http-3A__karaf.apache.org_&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=xfExu1hfXmeHJGNOwRi7V6BAOdGfQWz46G-MwykUt5Q&e=>>
Committer & PMC
OPS4J Pax Web
<http://wiki.ops4j.org/display/paxweb/Pax+Web/<https://urldefense.proofpoint.com/v2/url?u=http-3A__wiki.ops4j.org_display_paxweb_Pax-2BWeb_&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=FbwbpV1VhCyXC8kzpZx2nHYu8LnTKHxOTKEiKFU-6rA&e=>>
Committer & Project Lead
blog
<http://notizblog.nierbeck.de/<https://urldefense.proofpoint.com/v2/url?u=http-3A__notizblog.nierbeck.de_&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=g2Ogd7n4-LzV8K0YHTqHMI7HiGnnlkQzuIDnGMZ2yKU&e=>>
Co-Author of Apache Karaf Cookbook
<http://bit.ly/1ps9rkS<https://urldefense.proofpoint.com/v2/url?u=http-3A__bit.ly_1ps9rkS&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=zZb2lymjKyVkZw87YbecB_Hy4INOm4PQUutcdFxTFzw&s=BM5T6D1x9I1uOCss6CS8hN_wgm1H9H4uPrm4TW99XQA&e=>>
Software Architect / Project Manager / Scrum Master