Issue Type: Bug Bug
Affects Versions: 1.1.0.Beta2
Assignee: Unassigned
Attachments: patch.txt
Components: api
Created: 09/Dec/12 11:00 PM
Description:

While using DefaultProviderResolver, we get the following error when there are multiple validator implementations in classpath and the ones ahead in the classpath is not class loader compatible with the api jar:

javax.validation.ValidationException: Unable to load Bean Validation provider
at javax.validation.Validation$GetValidationProviderList.run(Validation.java:346)
at javax.validation.Validation$GetValidationProviderList.getValidationProviderList(Validation.java:310)
at javax.validation.Validation$DefaultValidationProviderResolver.getValidationProviders(Validation.java:292)
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:252)
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:107)
Truncated. see log file for complete stacktrace
Caused By: java.util.ServiceConfigurationError: javax.validation.spi.ValidationProvider: Provider org.hibernate.validator.HibernateValidator not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:231)
at java.util.ServiceLoader.access$300(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:369)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at javax.validation.Validation$GetValidationProviderList.run(Validation.java:343)
Truncated. see log file for complete stacktrace

I have tracked the error down to beanvalidation-api/src/main/java/javax/validation/Validation.java where it is not handling ServiceConfigurationError correctly. This code was introduced in BVAL-298. There was a discussion about ServiceConfigurationError in BVAL-280 as well. The correct thing to do is to ignore the ServiceConfigurationError and try the next available provider. I amm attaching a patch to this effect.

Project: Bean Validation
Priority: Critical Critical
Reporter: Sanjeeb Sahoo
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira