You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by "KARR, DAVID" <dk...@att.com> on 2017/06/05 15:37:36 UTC

PaxExam test using hibernate validator can't find validator

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/)"

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&amp;Bundle-SymbolicName=javax.validation&amp;Bundle-Version=1.1.0.Final</bundle>
        <bundle>mvn:org.hibernate/hibernate-validator/5.4.1.Final</bundle>
        <bundle>wrap:mvn:org.hibernate/hibernate-validator-osgi-karaf-features/5.4.1.Final$Bundle-Name=hibernate-validator-osgi-karaf-features&amp;Bundle-SymbolicName=hibernate-validator-osgi-karaf-features&amp;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.

Re: PaxExam test using hibernate validator can't find validator

Posted by Achim Nierbeck <bc...@googlemail.com>.
hmm ...
is it possible for you to show us your feature file?
Or maybe it's possible for you to start writing a simpler example that also
fails.
I doubt there is something wrong on Karaf or Pax Exam.

With a simple example it might be easier for us to show you where the
crucial step is.

regards, Achim


2017-06-05 21:42 GMT+02:00 KARR, DAVID <dk...@att.com>:

> Ok, I guess I’ve resolved my package resolution issues.  I finally
> realized that "hibernate-validator-osgi-features" is not a feature id,
> but simply the “name” property in the “features” element in the
> features.xml file.  When I changed my feature reference to
> “hibernate-validator” (you may have been trying to tell me this), that got
> past package resolution.
>
>
>
> Unfortunately, I’m now back to the original problem that led me to try
> tweaking the feature references, which is this:
>
>
>
> Unable to create a Configuration, because no Bean Validation provider
> could be found. Add a provider like Hibernate Validator (RI) to your
> classpath.
>
>
>
> The feature references were definitely wrong before, but there must be
> something else wrong now after fixing the feature references.
>
>
>
> I tried changing the “LogLevel” in my PaxExam configuration from WARNING
> to DEBUG.  This gave me a lot more information, but I don’t know if it’s
> useful.  Is there some other karaf config that might be relevant here?
>
>
>
> *From:* Achim Nierbeck [mailto:bcanhome@googlemail.com]
> *Sent:* Monday, June 05, 2017 11:48 AM
>
> *To:* user@karaf.apache.org
> *Subject:* Re: PaxExam test using hibernate validator can't find validator
>
>
>
> Hi,
>
>
>
> You can extract the resolution chain from that message:
>
>
> 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))"
>
>
>
> means that this feature can't be resolve because -->
>
>
>
> [caused by: Unable to resolve usl-fraudcheck/2.5.0.SNAPSHOT:
>
>
>
>
>
> a missing requirement:
>
> 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
>
>
>
> the bundle com.att.detsusl.usl-fraudcheck-api in version 2.5.0-SNAPSHOT
> can't be resolved
>
> [caused by: Unable to resolve com.att.detsusl.usl-
> fraudcheck-api/2.5.0.SNAPSHOT:
>
>
>
> beacause of a missing requirement:
>
>
>
> missing requirement [com.att.detsusl.usl-fraudcheck-api/2.5.0.SNAPSHOT]
>
>
>
> a package -->
>
> osgi.wiring.package; filter:="(&(osgi.wiring.package=
>
>
>
>
>
> javax.validation)(version>=1.1.0)(!(version>=2.0.0)))"]]
>
>
>
> in version greater 1.1.0 and less then 2.0.0
>
>
>
>
>
> regarding
>
>
>
> 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.
>
>
>
> I fear you misunderstand the difference between a feature file and
> bundles.
>
>
>
> First of all a bundle is a jar with OSGi Manifest entries declaring
> Package-Imports and Package Exports.
>
> Package-Imports are such "requirements"
>
> For example your
>
> com.att.detsusl.usl-fraudcheck-api
>
> declares an Import Package requirement, or better an osgi.wiring.package
> requirement for
>
> a package javax.validation in a specific version range.
>
> In that case it needs to be at least 1.1.0 but not any higher then 2.0.0.
>
>
>
> A feature file is something used in the context of Karaf, it's not part of
> any OSGi spec. Such feature files usually declare how to
>
> install an application consistent of more then one bundle in a go.
>
> So in your case that would be the usl-fraudcheck part of your application.
>
>
>
> From your saying I take that your sub-modules aren't cleanly separated so
> it seems like your usl-fraudcheck-impl maven module not only contains the
> implementation bundle for the api but also a feature file.
>
> From a maven POV this is a bad thing, as you usually have one module for
> one artifact.
>
> Instead of that I would try to create a separate submodule for the karaf
> feature.
>
> For example have one feature file which consists of multiple features, all
> of which are enough to be used standalone.
>
> If one of the features depends on another feature you can declare such a
> dependency much easier.
>
>
>
> Now coming back to your issue, you somehow also need to add a bundle to
> your feature which provided you with the requested
>
> javax.validation package.
>
> The official javax.validation[1] bundle already contains of the required
> OSGi manifest entries for Package-Import and Export so should be
> sufficient.
>
>
>
> regards, Achim
>
>
>
> [1] - http://search.maven.org/#artifactdetails%7Cjavax.
> validation%7Cvalidation-api%7C1.1.0.Final%7Cjar
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__search.maven.org_-23artifactdetails-257Cjavax.validation-257Cvalidation-2Dapi-257C1.1.0.Final-257Cjar&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=tHdfACCxFvRUzScmpuFRg4c71-IeURLX-OKDgQwsoRg&e=>
>
>
>
>
>
> 2017-06-05 20:13 GMT+02:00 KARR, DAVID <dk...@att.com>:
>
> 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.
> <https://urldefense.proofpoint.com/v2/url?u=http-3A__2.5.0.&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=q6XDbfJZnrXneXoyWHISc-zpPs7FVmul6VR3yxg5OJg&e=>
> 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:bcanhome@googlemail.com]
> *Sent:* Monday, June 05, 2017 10:52 AM
>
>
> *To:* user@karaf.apache.org
> *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 <dk...@att.com>:
>
> 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:bcanhome@googlemail.com]
> *Sent:* Monday, June 05, 2017 9:29 AM
> *To:* user@karaf.apache.org
> *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 <dk...@att.com>:
>
> 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&amp;Bundle-
> SymbolicName=javax.validation&amp;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&
> amp;Bundle-SymbolicName=hibernate-validator-osgi-
> karaf-features&amp;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
>
>
>
>
>
>
>
> --
>
>
> 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=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=HrPk4KRtpd3aLag6S0u-kaA8pQvb6MDLQeYtc29ajKU&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=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=biaSLl2icbrQ96iHIhB5whnAXA5VNVTmAYsu9lS-pMc&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=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=ZdB5uQH6fftyCHm04orCF7NpR3juOmw5t6evDIaoEL0&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=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=h21xVZZQFF7JoqmxvzTrykzlm_Qwccz19l87KVqSUug&e=>
> >
>
>
>
> Software Architect / Project Manager / Scrum Master
>
>
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

RE: PaxExam test using hibernate validator can't find validator

Posted by "KARR, DAVID" <dk...@att.com>.
Ok, I guess I’ve resolved my package resolution issues.  I finally realized that "hibernate-validator-osgi-features" is not a feature id, but simply the “name” property in the “features” element in the features.xml file.  When I changed my feature reference to “hibernate-validator” (you may have been trying to tell me this), that got past package resolution.

Unfortunately, I’m now back to the original problem that led me to try tweaking the feature references, which is this:

Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.

The feature references were definitely wrong before, but there must be something else wrong now after fixing the feature references.

I tried changing the “LogLevel” in my PaxExam configuration from WARNING to DEBUG.  This gave me a lot more information, but I don’t know if it’s useful.  Is there some other karaf config that might be relevant here?

From: Achim Nierbeck [mailto:bcanhome@googlemail.com]
Sent: Monday, June 05, 2017 11:48 AM
To: user@karaf.apache.org
Subject: Re: PaxExam test using hibernate validator can't find validator

Hi,

You can extract the resolution chain from that message:

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))"

means that this feature can't be resolve because -->

[caused by: Unable to resolve usl-fraudcheck/2.5.0.SNAPSHOT:


a missing requirement:
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

the bundle com.att.detsusl.usl-fraudcheck-api in version 2.5.0-SNAPSHOT can't be resolved
[caused by: Unable to resolve com.att.detsusl.usl-fraudcheck-api/2.5.0.SNAPSHOT:

beacause of a missing requirement:

missing requirement [com.att.detsusl.usl-fraudcheck-api/2.5.0.SNAPSHOT]

a package -->
osgi.wiring.package; filter:="(&(osgi.wiring.package=


javax.validation)(version>=1.1.0)(!(version>=2.0.0)))"]]

in version greater 1.1.0 and less then 2.0.0


regarding

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.

I fear you misunderstand the difference between a feature file and bundles.

First of all a bundle is a jar with OSGi Manifest entries declaring Package-Imports and Package Exports.
Package-Imports are such "requirements"
For example your
com.att.detsusl.usl-fraudcheck-api
declares an Import Package requirement, or better an osgi.wiring.package requirement for
a package javax.validation in a specific version range.
In that case it needs to be at least 1.1.0 but not any higher then 2.0.0.

A feature file is something used in the context of Karaf, it's not part of any OSGi spec. Such feature files usually declare how to
install an application consistent of more then one bundle in a go.
So in your case that would be the usl-fraudcheck part of your application.

From your saying I take that your sub-modules aren't cleanly separated so it seems like your usl-fraudcheck-impl maven module not only contains the implementation bundle for the api but also a feature file.
From a maven POV this is a bad thing, as you usually have one module for one artifact.
Instead of that I would try to create a separate submodule for the karaf feature.
For example have one feature file which consists of multiple features, all of which are enough to be used standalone.
If one of the features depends on another feature you can declare such a dependency much easier.

Now coming back to your issue, you somehow also need to add a bundle to your feature which provided you with the requested
javax.validation package.
The official javax.validation[1] bundle already contains of the required OSGi manifest entries for Package-Import and Export so should be sufficient.

regards, Achim

[1] - http://search.maven.org/#artifactdetails%7Cjavax.validation%7Cvalidation-api%7C1.1.0.Final%7Cjar<https://urldefense.proofpoint.com/v2/url?u=http-3A__search.maven.org_-23artifactdetails-257Cjavax.validation-257Cvalidation-2Dapi-257C1.1.0.Final-257Cjar&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=tHdfACCxFvRUzScmpuFRg4c71-IeURLX-OKDgQwsoRg&e=>


2017-06-05 20:13 GMT+02:00 KARR, DAVID <dk...@att.com>>:
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.<https://urldefense.proofpoint.com/v2/url?u=http-3A__2.5.0.&d=DwMFaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=OsTemSXEn-xy2uk0vYF_EA&m=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=q6XDbfJZnrXneXoyWHISc-zpPs7FVmul6VR3yxg5OJg&e=>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:bcanhome@googlemail.com<ma...@googlemail.com>]
Sent: Monday, June 05, 2017 10:52 AM

To: user@karaf.apache.org<ma...@karaf.apache.org>
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 <dk...@att.com>>:
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:bcanhome@googlemail.com<ma...@googlemail.com>]
Sent: Monday, June 05, 2017 9:29 AM
To: user@karaf.apache.org<ma...@karaf.apache.org>
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 <dk...@att.com>>:
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&amp;Bundle-SymbolicName=javax.validation&amp;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&amp;Bundle-SymbolicName=hibernate-validator-osgi-karaf-features&amp;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




--

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=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=HrPk4KRtpd3aLag6S0u-kaA8pQvb6MDLQeYtc29ajKU&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=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=biaSLl2icbrQ96iHIhB5whnAXA5VNVTmAYsu9lS-pMc&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=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=ZdB5uQH6fftyCHm04orCF7NpR3juOmw5t6evDIaoEL0&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=jEaNW4dvHQ_7LqKx65IlqrH9OipkUvP-yPPjF74xnO4&s=h21xVZZQFF7JoqmxvzTrykzlm_Qwccz19l87KVqSUug&e=>>

Software Architect / Project Manager / Scrum Master


Re: PaxExam test using hibernate validator can't find validator

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

You can extract the resolution chain from that message:

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))"

means that this feature can't be resolve because -->

[caused by: Unable to resolve usl-fraudcheck/2.5.0.SNAPSHOT:


a missing requirement:
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

the bundle com.att.detsusl.usl-fraudcheck-api in version 2.5.0-SNAPSHOT
can't be resolved
[caused by: Unable to resolve
com.att.detsusl.usl-fraudcheck-api/2.5.0.SNAPSHOT:

beacause of a missing requirement:

missing requirement [com.att.detsusl.usl-fraudcheck-api/2.5.0.SNAPSHOT]

a package -->
osgi.wiring.package; filter:="(&(osgi.wiring.package=


javax.validation)(version>=1.1.0)(!(version>=2.0.0)))"]]

in version greater 1.1.0 and less then 2.0.0


regarding

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.


I fear you misunderstand the difference between a feature file and bundles.

First of all a bundle is a jar with OSGi Manifest entries declaring
Package-Imports and Package Exports.
Package-Imports are such "requirements"
For example your
com.att.detsusl.usl-fraudcheck-api
declares an Import Package requirement, or better an osgi.wiring.package
requirement for
a package javax.validation in a specific version range.
In that case it needs to be at least 1.1.0 but not any higher then 2.0.0.

A feature file is something used in the context of Karaf, it's not part of
any OSGi spec. Such feature files usually declare how to
install an application consistent of more then one bundle in a go.
So in your case that would be the usl-fraudcheck part of your application.

From your saying I take that your sub-modules aren't cleanly separated so
it seems like your usl-fraudcheck-impl maven module not only contains the
implementation bundle for the api but also a feature file.
From a maven POV this is a bad thing, as you usually have one module for
one artifact.
Instead of that I would try to create a separate submodule for the karaf
feature.
For example have one feature file which consists of multiple features, all
of which are enough to be used standalone.
If one of the features depends on another feature you can declare such a
dependency much easier.

Now coming back to your issue, you somehow also need to add a bundle to
your feature which provided you with the requested
javax.validation package.
The official javax.validation[1] bundle already contains of the required
OSGi manifest entries for Package-Import and Export so should be
sufficient.

regards, Achim

[1] -
http://search.maven.org/#artifactdetails%7Cjavax.validation%7Cvalidation-api%7C1.1.0.Final%7Cjar


2017-06-05 20:13 GMT+02:00 KARR, DAVID <dk...@att.com>:

> 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:bcanhome@googlemail.com]
> *Sent:* Monday, June 05, 2017 10:52 AM
>
> *To:* user@karaf.apache.org
> *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 <dk...@att.com>:
>
> 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:bcanhome@googlemail.com]
> *Sent:* Monday, June 05, 2017 9:29 AM
> *To:* user@karaf.apache.org
> *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 <dk...@att.com>:
>
> 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&amp;Bundle-
> SymbolicName=javax.validation&amp;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&
> amp;Bundle-SymbolicName=hibernate-validator-osgi-
> karaf-features&amp;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
>
>
>



-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

RE: PaxExam test using hibernate validator can't find validator

Posted by "KARR, DAVID" <dk...@att.com>.
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:bcanhome@googlemail.com]
Sent: Monday, June 05, 2017 10:52 AM
To: user@karaf.apache.org
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 <dk...@att.com>>:
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:bcanhome@googlemail.com<ma...@googlemail.com>]
Sent: Monday, June 05, 2017 9:29 AM
To: user@karaf.apache.org<ma...@karaf.apache.org>
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 <dk...@att.com>>:
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&amp;Bundle-SymbolicName=javax.validation&amp;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&amp;Bundle-SymbolicName=hibernate-validator-osgi-karaf-features&amp;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


Re: PaxExam test using hibernate validator can't find validator

Posted by Achim Nierbeck <bc...@googlemail.com>.
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

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 <dk...@att.com>:

> 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.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.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>.
>
>   -->
>
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"
>
>     name="hibernate-validator-osgi-features"
>
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
>     xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.4.0">
>
>
>
> 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:bcanhome@googlemail.com]
> *Sent:* Monday, June 05, 2017 9:29 AM
> *To:* user@karaf.apache.org
> *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 <dk...@att.com>:
>
> 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&amp;Bundle-
> SymbolicName=javax.validation&amp;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&
> amp;Bundle-SymbolicName=hibernate-validator-osgi-
> karaf-features&amp;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/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

RE: PaxExam test using hibernate validator can't find validator

Posted by "KARR, DAVID" <dk...@att.com>.
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.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.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>.
  -->
<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"
    name="hibernate-validator-osgi-features"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.4.0">

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:bcanhome@googlemail.com]
Sent: Monday, June 05, 2017 9:29 AM
To: user@karaf.apache.org
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 <dk...@att.com>>:
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&amp;Bundle-SymbolicName=javax.validation&amp;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&amp;Bundle-SymbolicName=hibernate-validator-osgi-karaf-features&amp;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


Re: PaxExam test using hibernate validator can't find validator

Posted by Achim Nierbeck <bc...@googlemail.com>.
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
[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

2017-06-05 17:37 GMT+02:00 KARR, DAVID <dk...@att.com>:

> 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/)"
>
> 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&amp;Bundle-
> SymbolicName=javax.validation&amp;Bundle-Version=1.1.0.Final</bundle>
>         <bundle>mvn:org.hibernate/hibernate-validator/5.4.1.Final</bundle>
>         <bundle>wrap:mvn:org.hibernate/hibernate-validator-
> osgi-karaf-features/5.4.1.Final$Bundle-Name=hibernate-
> validator-osgi-karaf-features&amp;Bundle-SymbolicName=
> hibernate-validator-osgi-karaf-features&amp;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/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master