-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate Validator in Spring+OSGI
PostPosted: Sat Nov 21, 2015 5:16 am 
Beginner
Beginner

Joined: Wed Aug 25, 2004 10:27 pm
Posts: 21
Location: Indonesia
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


Top
 Profile  
 
 Post subject: Re: Hibernate Validator in Spring+OSGI
PostPosted: Mon Nov 23, 2015 9:07 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi,

What exactly do you mean by "seems to halt in class org.hibernate.validator.internal.engine.ConfigurationImpl in the following line"? Are you stepping through this in a debugger and see the program blocked at some point?

What OSGi runtime is this btw.? We do have some OSGi integration tests and also provide an Apache Karaf features file (see https://github.com/hibernate/hibernate-validator/tree/master/osgi), which may be helpful for you purposes.

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.