Hi all,
I'm using Hibernate Validator in Spring+OSGI environment and since it's not known to be OSGI friendly I follow the WA here:
https://access.redhat.com/solutions/734273
So below is my implementation:
Code:
public final static ValidatorFactory buildValidatorFactory()
{
GenericBootstrap bootstrap = Validation.byDefaultProvider();
final List<ValidationProvider<HibernateValidatorConfiguration>> providers = new ArrayList<ValidationProvider<HibernateValidatorConfiguration>>();
providers.add(new HibernateValidator());
bootstrap = bootstrap.providerResolver
(
new ValidationProviderResolver()
{
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public List getValidationProviders(){return providers;}
}
);
return bootstrap.configure().buildValidatorFactory();
}
And my Spring config is as simple as below:
Code:
<bean id="validator" class="com.mycompany.ValidatorFactoryBuilder" factory-method="buildValidatorFactory"/>
If I run w/o OSGI it run fine, but with OSGI during startup the execution seems to halt in class org.hibernate.validator.internal.engine.ConfigurationImpl in the following line:
Code:
static {
Version.touch();
}
I'm using Hibernate Validator 5.2.2 Final.
Any help would be greatly appreciated.
Thanks & Regards,
Setya