You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Neil Griffin (Jira)" <ji...@apache.org> on 2021/12/17 02:27:00 UTC

[jira] [Closed] (PLUTO-794) Downgrade to hibernate-validator-5.4.3.Final and validation-api-1.1.0.Final in order to conform to Java EE 7

     [ https://issues.apache.org/jira/browse/PLUTO-794?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Neil Griffin closed PLUTO-794.
------------------------------
    Resolution: Fixed

> Downgrade to hibernate-validator-5.4.3.Final and validation-api-1.1.0.Final in order to conform to Java EE 7
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: PLUTO-794
>                 URL: https://issues.apache.org/jira/browse/PLUTO-794
>             Project: Pluto
>          Issue Type: Task
>          Components: build system, demo portlets, maven archetypes
>            Reporter: Neil Griffin
>            Assignee: Neil Griffin
>            Priority: Major
>             Fix For: 3.1.1
>
>         Attachments: stacktrace.txt
>
>
> Section 1.8 of the Portlet 3.0 Specification titled "Relationship to Java Enterprise Edition" states:
> {quote}The Portlet API v3.0 is based on the Java Standard Edition 7.0 and Java Enterprise Edition v7.0. Portlet containers should at least meet the requirements described by the Java EE 7.0 specification for executing in a Java EE environment.{quote}
> Pluto 3.x implements the Portlet 3.0 API and [targets Java EE 7, which includes the CDI 1.2 API and the Bean Validation 1.1 API|https://en.wikipedia.org/wiki/Jakarta_EE#Web_profile]. . As such, it relies on JBoss Weld 2.3.1.Final (which implements the CDI 1.2 API).
> When trying to upgrade to hibernate-validator-6.0.20.Final via PLUTO-791, the attached [^stacktrace.txt] started happening when trying to onblur out of the "Postal Code" field of the applicant-mvcbean-cdi-jsp-portlet demo. This revealed that hibernate-validator-6.0.20.Final was attempting to call the [javax.enterprise.inject.spi.BeanManager.createInstance()|https://javaee.github.io/javaee-spec/javadocs/javax/enterprise/inject/spi/BeanManager.html#createInstance--] method, which the Javadoc indicates was introduced in CDI 2.0.
> Upon closer examination, the [Hibernate Validator Releases page|https://hibernate.org/validator/releases/6.0/] states that version 6.0 targets Bean Validation 2.0, which explains why the Hibernate Validator implementation of the Bean Validation API would be permitted to call version 2.0 method signatures in the Bean Validation API.
> The [Hibernate Validator FAQ page|https://hibernate.org/validator/faq/#whats-the-difference-between-hibernate-validator-3-4-and-5] states that Hibernate Validator 5.x is the reference implementation of Bean Validation 1.1 (JSR 349). In addition, the project's main [pom.xml|https://github.com/hibernate/hibernate-validator/blob/5.4/pom.xml#L133] descriptor corroborates the FAQ. Therefore, in order to be compatible with CDI 1.2 and Bean Validation 1.1 (Java EE 7), it is necessary to downgrade to the newest version of Hibernate Validator 5.x (which is hibernate-validator-5.4.3.Final at the time of this writing) and validation-api-1.1.0.Final
> This task involves downgrading from the following dependency versions:
> {code:xml|title=pom.xml (before)}
> <dependency>
> 	<groupId>javax.validation</groupId>
> 	<artifactId>validation-api</artifactId>
> 	<version>2.0.1.Final</version>
> 	<scope>provided</scope>
> </dependency>
> <dependency>
> 	<groupId>org.hibernate</groupId>
> 	<artifactId>hibernate-validator</artifactId>
> 	<version>6.0.14.Final</version>
> 	<exclusions>
> 		<exclusion>
> 			<groupId>javax.validation</groupId>
> 			<artifactId>validation-api</artifactId>
> 		</exclusion>
> 	</exclusions>
> </dependency>
> <dependency>
> 	<groupId>org.hibernate</groupId>
> 	<artifactId>hibernate-validator-cdi</artifactId>
> 	<version>6.0.14.Final</version>
> </dependency>
> {code}
> {code:xml|title=pom.xml (after)}
> <dependency>
> 	<groupId>javax.validation</groupId>
> 	<artifactId>validation-api</artifactId>
> 	<version>1.1.0.Final</version>
> 	<scope>provided</scope>
> </dependency>
> <dependency>
> 	<groupId>org.hibernate</groupId>
> 	<artifactId>hibernate-validator</artifactId>
> 	<version>5.4.3.Final</version>
> 	<exclusions>
> 		<exclusion>
> 			<groupId>javax.validation</groupId>
> 			<artifactId>validation-api</artifactId>
> 		</exclusion>
> 	</exclusions>
> </dependency>
> <dependency>
> 	<groupId>org.hibernate</groupId>
> 	<artifactId>hibernate-validator-cdi</artifactId>
> 	<version>5.4.3.Final</version>
> </dependency>
> {code}
> In addition, since the demo and archetypes use Bean Validation 2.0 annotations such as:
> - @[javax.validation.constraints.NotBlank|https://javaee.github.io/javaee-spec/javadocs/javax/validation/constraints/NotBlank.html]
> - @[javax.validation.constraints.Email|https://javaee.github.io/javaee-spec/javadocs/javax/validation/constraints/Email.html]
> - @[javax.validation.constraints.Positive|https://javaee.github.io/javaee-spec/javadocs/javax/validation/constraints/Positive.html]
> ... it will be necessary to use their Bean Validation 1.2 counterparts, which are vendor-specific to Hibernate Validator:
> - @[org.hibernate.validator.constraints.NotBlank|https://docs.jboss.org/hibernate/validator/5.1/api/org/hibernate/validator/constraints/NotBlank.html]
> - @[org.hibernate.validator.constraints.Email|https://docs.jboss.org/hibernate/validator/5.1/api/org/hibernate/validator/constraints/Email.html]
> - @[org.hibernate.validator.constraints.Range|https://docs.jboss.org/hibernate/validator/5.1/api/org/hibernate/validator/constraints/Range.html]



--
This message was sent by Atlassian Jira
(v8.20.1#820001)