Validator fails with Google App Engine due to use of restricted class java.util.ResourceBundle.Control

Description

In version 5.2.2 this change was made to PlatformResourceBundleLocator.

That broke number of validators which were working fine in 5.2.1

This change causes exception on Google Appengine. PlatformResourceBundleLocator is referencing ResourceBundle class, which is blacklisted in Google Appengine.

java.lang.NoClassDefFoundError: java.util.ResourceBundle$Control is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.apphosting.runtime.security.shared.stub.java.util.ResourceBundle$Control.<clinit>(ResourceBundle.java) at org.hibernate.validator.resourceloading.PlatformResourceBundleLocator$AggregateResourceBundle.<clinit>(PlatformResourceBundleLocator.java:169) at org.hibernate.validator.resourceloading.PlatformResourceBundleLocator.loadBundle(PlatformResourceBundleLocator.java:132) at org.hibernate.validator.resourceloading.PlatformResourceBundleLocator.getResourceBundle(PlatformResourceBundleLocator.java:105) at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.interpolateMessage(AbstractMessageInterpolator.java:264) at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.interpolate(AbstractMessageInterpolator.java:216) at org.hibernate.validator.internal.engine.ValidationContext.interpolate(ValidationContext.java:422) at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolation(ValidationContext.java:300) at org.hibernate.validator.internal.engine.ValidationContext.createConstraintViolations(ValidationContext.java:261) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:456) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:127) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:87) at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:73) at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:592) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraint(ValidatorImpl.java:555) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:490) at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:454) at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:406) at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:204)

Environment

Google Appengine, Jersey

Activity

Show:

Gunnar Morling November 4, 2015 at 4:21 PM

Hey , the PR has be been merged into master now. Could you get the latest snapshot from the JBoss repo and give it a try: https://repository.jboss.org/nexus/content/repositories/public/org/hibernate/hibernate-validator/5.3.0-SNAPSHOT/

Thanks!

Hardy Ferentschik November 4, 2015 at 12:21 PM

, snapshots are deployed to the JBoss Nexus Repository - https://repository.jboss.org/nexus/#welcome. Here you find some info on how to configure it.

Btw, we already merged the fix to master, so you can just use 5.3.0-SNAPSHOT as version.

Huseyn Guliyev November 1, 2015 at 12:18 AM
Edited

Thanks for the fix. Can you advice which repository i can find this in? I get this error:

[ERROR] Failed to execute goal on project ... The following artifacts could not be resolved: org.hibernate:hibernate-validator-annotation-processor:jar:5.3.0-20151027.141049-99, Could not find artifact org.hibernate:hibernate-validator-annotation-processor:jar:5.3.0-20151027.141049-99 in sonatype-snapshots

Hardy Ferentschik October 27, 2015 at 2:18 PM
Edited

, here is my shot at providing a solution to the App engine issue - https://github.com/hferentschik/hibernate-validator/commit/a6b4f9a87abe2c9d5a0148174ff64b7702703974

Could you maybe verify that it works for you by running your app with the following SNAPSHOT build:

<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>5.3.0-20151027.141049-99</version> </dependency>

Huseyn Guliyev October 23, 2015 at 8:58 PM

Both options are good. First is automatic, so library will work as it is. Second will allow to configure for GAE. So basically, both will provide a mechanism for HV to work with Appengine.

I guess first is better option, if one has to choose.

Here is more about Appengine Java Runtime Environment
https://cloud.google.com/appengine/docs/java/#Java_The_environment

Thanks

Fixed

Details

Assignee

Reporter

Bug Testcase Reminder (view)

Bug reports should generally be accompanied by a test case!

Bug Testcase Reminder (edit)

Bug reports should generally be accompanied by a test case!

Participants

Gunnar Morling
Hardy Ferentschik
Huseyn Guliyev

Components

Affects versions

Priority

Created October 20, 2015 at 1:46 PM
Updated January 27, 2016 at 8:59 AM
Resolved January 26, 2016 at 7:16 PM