Issues
- Hibernate-Validator is missing some of the OSGI export-package definitionsHV-1449Resolved issue: HV-1449
- hibernate-validator-cdi artefact is not OSGI'edHV-1294Resolved issue: HV-1294Guillaume Smet
- JaCoCo code coverage fails since ConstraintDescriptorImpl#buildAnnotationParameterMap() does not filter out synthetic methodsHV-1184Resolved issue: HV-1184
- ValueContext is using OptionalValueUnwrapper for all fieldsHV-1127Resolved issue: HV-1127Guillaume Smet
- Validation error path generation for TYPE_USE annotationHV-1121Resolved issue: HV-1121Guillaume Smet
- Issues when using XML validation configurationHV-1101Resolved issue: HV-1101Guillaume Smet
- java.lang.StackOverflowError generated when using too big validation messageHV-1091Resolved issue: HV-1091Gunnar Morling
- Validation of Java 8 Optional throws ClassCastExceptionHV-1080Resolved issue: HV-1080Gunnar Morling
- Parameter validation does not stop when group in sequence has cascaded constraint violations.HV-1072Resolved issue: HV-1072
- Allow public API to access validation metadata in a developer friendly wayHV-1067Resolved issue: HV-1067
- email domains with a 63 character length fails EmailValidatorHV-1066Resolved issue: HV-1066Guillaume Smet
- Use type annotations for map values with @NotNull annotation on the mapHV-1062Resolved issue: HV-1062Guillaume Smet
Hibernate-Validator is missing some of the OSGI export-package definitions
Description
Environment
Attachments
duplicates
relates to
Details
Assignee
UnassignedUnassignedReporter
Mert CaliskanMert CaliskanParticipants
Arjan TijmsGuillaume SmetGunnar MorlingMert CaliskanComponents
Affects versions
Priority
Major
Details
Details
Assignee
Reporter
Participants
Components
Affects versions
Priority
Activity
Guillaume SmetSeptember 6, 2017 at 9:56 AM
@Mert Caliskan it looks like @Arjan Tijms proposed a way out in this issue https://hibernate.atlassian.net/browse/HV-1478 so I'm closing this one as a duplicate and please follow what we do in this other issue.
Hopefully, we will get this all fixed in the upcoming 6.0.3 release!
Thanks for raising this issue.
Arjan TijmsAugust 24, 2017 at 12:20 PM
@gsmet I see, although wondering why the redirect artefact would be identical to the actual location, but without the OSGi headers.
I tried the latest 6.0.2 version btw. The symbolic name is now correct, but the fragment is still ignored by Felix. Removing the fragment from the OSGi headers results in:
org.osgi.framework.BundleException: Unresolved constraint in bundle org.hibernate.validator.hibernate-validator-cdi [125]: Unable to resolve 125.0: missing requirement [125.0] osgi.wiring.package; (&(osgi.wiring.package=org.hibernate.validator.internal.engine)(version>=6.0.2.Final)(version<=6.0.2.Final))
at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1824)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)
at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$4$1.run(OSGiModuleImpl.java:432)
at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$4$1.run(OSGiModuleImpl.java:429)
at java.security.AccessController.doPrivileged(Native Method)
at org.jvnet.hk2.osgiadapter.OSGiModuleImpl$4.loadClass(OSGiModuleImpl.java:429)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.sun.enterprise.v3.server.APIClassLoaderServiceImpl$APIClassLoader.loadClass(APIClassLoaderServiceImpl.java:260)
So unfortunately still doesn't work out of the box.
Guillaume SmetAugust 9, 2017 at 5:29 PM
@Arjan Tijms as for 6.0.1.Final, you downloaded the relocation artifact. You should use org.hibernate.validator:hibernate-validator-cdi (so with a trailing validator at the end of the groupId).
Arjan TijmsAugust 9, 2017 at 5:05 PM
Weird, that's the full META-INF/MANIFEST.MF of that JAR as deployed to Maven Central:
That's weird indeed, I just checked again by downloading directly and it actually does not contain those headers when I try it:
wget http://central.maven.org/maven2/org/hibernate/hibernate-validator-cdi/6.0.1.Final/hibernate-validator-cdi-6.0.1.Final.jar -O tmp.zip && unzip -p tmp.zip META-INF/MANIFEST.MF
--2017-08-09 17:48:33-- http://central.maven.org/maven2/org/hibernate/hibernate-validator-cdi/6.0.1.Final/hibernate-validator-cdi-6.0.1.Final.jar
Resolving central.maven.org... 151.101.36.209
Connecting to central.maven.org|151.101.36.209|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1843 (1.8K) [application/java-archive]
Saving to: ‘tmp.zip’
tmp.zip 100%[=================================================>] 1.80K --.-KB/s in 0s
2017-08-09 17:48:34 (60.6 MB/s) - ‘tmp.zip’ saved [1843/1843]
Manifest-Version: 1.0
Implementation-Title: hibernate-validator-cdi
Implementation-Version: 6.0.1.Final
Built-By: jenkins
Implementation-Vendor-Id: org.hibernate.validator
Created-By: Apache Maven 3.5.0
Build-Jdk: 1.8.0_121
Implementation-URL: http://hibernate.org/validator/
Implementation-Vendor: org.hibernate.validator
Does this mean that Felix doesn't really support fragments at all? Or is there a way to mandate the order of resolution?
It seems to support them as long as the fragment is resolved first. I could of course try what the latest version does, but 4.x (from 2013, which incidentally is what GlassFish 5 is using as well) didn't work.
Perhaps with the Require-Capability
and Provide-Capability
you can essentially have the host "import" the fragment, but that begs the question why a fragment should be used at all if the host has (indirectly) knowledge of it.
Maybe it's related to your statement above that you don't see any OSGi headers in the CDI module at all?
It's only hibernate-validator-cdi-6.0.1.Final.jar
that doesn't seem to have the OSGi headers. All other versions and all versions of hibernate-validator-xyz.jar
do have those headers.
The modified hibernate-validator-cdi.jar
manifest that worked for me is as follows:
(I tested last with 6.0.0.CR3)
Manifest-Version: 1.0
Automatic-Module-Name: org.hibernate.validator.cdi
Bnd-LastModified: 1501524595261
Build-Jdk: 1.8.0_121
Built-By: jenkins
Bundle-Description: Hibernate Validator CDI Portable Extension
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-ManifestVersion: 2
Bundle-Name: hibernate-validator-cdi
Bundle-SymbolicName: org.hibernate
Bundle-Version: 6.0.0.CR3
Created-By: 1.8.0_102 (Oracle Corporation)
Export-Package: org.hibernate.validator.cdi;version="6.0.0.CR3";uses:="j
avax.inject",org.hibernate.validator.cdi.internal;version="6.0.0.CR3";u
ses:="javax.enterprise.context.spi,javax.enterprise.event,javax.enterpr
ise.inject.spi,javax.inject,javax.validation,javax.validation.executabl
e",org.hibernate.validator.cdi.internal.interceptor;version="6.0.0.CR3"
;uses:="javax.annotation,javax.enterprise.inject.spi,javax.interceptor"
Implementation-Title: hibernate-validator-cdi
Implementation-URL: http://hibernate.org/validator/
Implementation-Vendor: org.hibernate.validator
Implementation-Vendor-Id: org.hibernate.validator
Implementation-Version: 6.0.0.CR3
Import-Package: javax.annotation,javax.enterprise.context,javax.enterpri
se.context.spi,javax.enterprise.event,javax.enterprise.inject,javax.ent
erprise.inject.spi,javax.enterprise.util,javax.inject,javax.interceptor
,javax.validation,javax.validation.bootstrap,javax.validation.executabl
e,javax.validation.metadata,javax.validation.valueextraction,org.hibern
ate.validator,org.hibernate.validator.internal.engine,org.hibernate.val
idator.internal.engine.valueextraction,org.hibernate.validator.internal
.util,org.hibernate.validator.internal.util.classhierarchy,org.hibernat
e.validator.internal.util.logging,org.hibernate.validator.internal.util
.privilegedactions
Originally-Created-By: Apache Maven Bundle Plugin
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Specification-Title: Bean Validation
Specification-Version: 2.0
Tool: Bnd-2.4.0.201411031536
For hibernate-validator.jar
it's:
Manifest-Version: 1.0
Implementation-Title: hibernate-validator
Bundle-Description: Hibernate's Bean Validation (JSR-380) reference im
plementation.
Automatic-Module-Name: org.hibernate.validator
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-SymbolicName: org.hibernate.validator.hibernate-validator
Implementation-Version: 6.0.0.CR3
Built-By: jenkins
Bnd-LastModified: 1499786175488
Bundle-ManifestVersion: 2
Implementation-Vendor-Id: org.hibernate.validator
Specification-Title: Bean Validation
Import-Package: javax.persistence;version="[2.0.0,3.0.0)";resolution:=
optional,javax.validation;version="[2.0.0,3.0.0)",javax.validation.co
nstraints;version="[2.0.0,3.0.0)",javax.validation.constraintvalidati
on;version="[2.0.0,3.0.0)",javax.validation.executable;version="[2.0.
0,3.0.0)",javax.validation.groups;version="[2.0.0,3.0.0)",javax.valid
ation.metadata;version="[2.0.0,3.0.0)",javax.validation.spi;version="
[2.0.0,3.0.0)",javax.validation.valueextraction;version="[2.0.0,3.0.0
)",javax.xml.bind;version=0,javax.xml.bind.annotation;version=0,javax
.xml.bind.annotation.adapters;version=0,javax.xml.namespace;version=0
,javax.xml.stream;version=0,javax.xml.stream.events;version=0,javax.x
ml.stream.util;version=0,javax.xml.transform;version=0,javax.xml.tran
sform.stream;version=0,javax.xml.validation;version=0,javax.el;versio
n="[2.0.0,4.0.0)";resolution:=optional,org.xml.sax;version=0,org.jbos
s.logging;version="[3.1.0,4.0.0)",com.fasterxml.classmate;version="[1
.3.1,2.0.0)",com.fasterxml.classmate.members;version="[1.3.1,2.0.0)",
org.joda.time;version="[2.0.0,3.0.0)";resolution:=optional,org.jsoup;
version="[1.5.2,2.0.0)";resolution:=optional,org.jsoup.nodes;version=
"[1.5.2,2.0.0)";resolution:=optional,org.jsoup.parser;version="[1.5.2
,2.0.0)";resolution:=optional,org.jsoup.safety;version="[1.5.2,2.0.0)
";resolution:=optional,org.jsoup.select;version="[1.5.2,2.0.0)";resol
ution:=optional,javax.money;version="[1.0.0,2.0.0)";resolution:=optio
nal,com.thoughtworks.paranamer;version="[2.5.5,3.0.0)";resolution:=op
tional
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-3.2.0.201605172007
Implementation-Vendor: org.hibernate.validator
Export-Package: org.hibernate.validator;version="6.0.0.CR3";uses:="jav
ax.validation,javax.validation.spi,javax.validation.valueextraction,o
rg.hibernate.validator.cfg,org.hibernate.validator.spi.resourceloadin
g",org.hibernate.validator.cfg;version="6.0.0.CR3";uses:="javax.valid
ation,org.hibernate.validator.cfg.context",org.hibernate.validator.cf
g.context;version="6.0.0.CR3";uses:="javax.validation,org.hibernate.v
alidator.cfg,org.hibernate.validator.spi.group",org.hibernate.validat
or.cfg.defs;version="6.0.0.CR3";uses:="javax.validation.constraints,o
rg.hibernate.validator.cfg,org.hibernate.validator.constraints,org.hi
bernate.validator.constraints.time",org.hibernate.validator.cfg.defs.
br;version="6.0.0.CR3";uses:="org.hibernate.validator.cfg,org.hiberna
te.validator.constraints.br",org.hibernate.validator.cfg.defs.pl;vers
ion="6.0.0.CR3";uses:="org.hibernate.validator.cfg,org.hibernate.vali
dator.constraints.pl",org.hibernate.validator.constraints;version="6.
0.0.CR3";uses:="javax.validation,javax.validation.constraints",org.hi
bernate.validator.constraints.br;version="6.0.0.CR3";uses:="javax.val
idation,javax.validation.constraints,org.hibernate.validator.constrai
nts",org.hibernate.validator.constraints.pl;version="6.0.0.CR3";uses:
="javax.validation",org.hibernate.validator.constraints.time;version=
"6.0.0.CR3";uses:="javax.validation",org.hibernate.validator.constrai
ntvalidation;version="6.0.0.CR3";uses:="javax.validation",org.hiberna
te.validator.constraintvalidators;version="6.0.0.CR3";uses:="javax.va
lidation,org.hibernate.validator.constraints",org.hibernate.validator
.engine;version="6.0.0.CR3";uses:="javax.validation",org.hibernate.va
lidator.group;version="6.0.0.CR3";uses:="org.hibernate.validator.spi.
group",org.hibernate.validator.messageinterpolation;version="6.0.0.CR
3";uses:="javax.el,javax.validation,org.hibernate.validator.spi.resou
rceloading",org.hibernate.validator.parameternameprovider;version="6.
0.0.CR3";uses:="com.thoughtworks.paranamer,javax.validation",org.hibe
rnate.validator.path;version="6.0.0.CR3";uses:="javax.validation",org
.hibernate.validator.resourceloading;version="6.0.0.CR3";uses:="org.h
ibernate.validator.spi.resourceloading",org.hibernate.validator.spi.c
fg;version="6.0.0.CR3";uses:="org.hibernate.validator.cfg",org.hibern
ate.validator.spi.group;version="6.0.0.CR3",org.hibernate.validator.s
pi.resourceloading;version="6.0.0.CR3",org.hibernate.validator.intern
al.engine;version="6.0.0.CR3",org.hibernate.validator.internal.util;v
ersion="6.0.0.CR3",org.hibernate.validator.internal.util.classhierarc
hy;version="6.0.0.CR3",org.hibernate.validator.internal.util.logging;
version="6.0.0.CR3",org.hibernate.validator.internal.util.privilegeda
ctions;version="6.0.0.CR3",org.hibernate.validator.internal.engine.va
lueextraction;version="6.0.0.CR3"
Bundle-Name: Hibernate Validator Engine
Bundle-Version: 6.0.0.CR3
Created-By: Apache Maven Bundle Plugin
Build-Jdk: 1.8.0_121
Implementation-URL: http://hibernate.org/validator/
Specification-Version: 2.0
Gunnar MorlingAugust 9, 2017 at 7:09 AM
On the resolution issue, this SO post may provide an answer: https://stackoverflow.com/questions/11029768/when-is-an-osgi-fragment-attached-to-host. Seems you could mandate a specific start order of the host and fragment bundles?
After having hibernate-validator-cdi OSGI'ed as mentioned here, OSGI container complains about missing packages from hibernate-validator itself. So I added the export-package definitions given below. They are internal packages as their names state, so it might be better to move them to a different package in the upcoming version as well.
org.hibernate.validator.internal.engine;version="5.2.4.Final" org.hibernate.validator.internal.util;version="5.2.4.Final" org.hibernate.validator.internal.util.classhierarchy;version="5.2.4.Final", org.hibernate.validator.internal.util.logging;version="5.2.4.Final" org.hibernate.validator.internal.util.privilegedactions;version="5.2.4.Final"
The full version of modified manifest file is attached:
.