-->
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.  [ 3 posts ] 
Author Message
 Post subject: Validator in OSGI enviroment
PostPosted: Mon Aug 02, 2010 3:02 am 
Newbie

Joined: Mon Aug 02, 2010 2:23 am
Posts: 1
I would like to know if there is a possibility how to solve problem when I have my own library that uses hibernate validator and it is running in standard and also OSGI environment. It means the same library is used in OSGI-based server and also for client which isn't OSGI-based. For standard environment everything works fine but for OSGI I have got exception :

javax.validation.ValidationException: Unable to find a default provider
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)

There are instructions what to do for OSGI (ValidationProviderResolver), so I assume it will work. But will it work also in standard environment?


Top
 Profile  
 
 Post subject: Re: Validator in OSGI enviroment
PostPosted: Tue Aug 10, 2010 2:09 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I am not an OSGI expert, but would your library not include the required OSGI metadata in its manifest. In particular the dependency to Bean Validation?

--Hardy


Top
 Profile  
 
 Post subject: Re: Validator in OSGI enviroment
PostPosted: Wed Aug 18, 2010 5:31 pm 
Hibernate Team
Hibernate Team

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

the general problem here is that the standard approach defined by the BV spec for finding BV providers - which utilizes Java's service loader mechanism - per definition does not work in OSGi environments.

This is because in OSGi the BV bundle can't see any service provider configuration files provided by implementation bundles in META-INF/services. As mentioned in the spec (section 4.4.4.1) the idea here would be to implement a custom ValidationProviderResolver which leverages for instance OSGi declarative services to make BV implementations known to the BV bootstrapping. So you would work with this custom resolver within an OSGi environment and with the default resolver provided by BV within in a standard environment with one common class path.

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.  [ 3 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.