Willem, Not sure what you mean. I solved the problem by exporting the META-INF and the META-INF.services "packages". That's all it took.
However, your version does not seem to work since no default provider can be found ...Aha now I see what you wrote in your mail... You mean you need to hack the VALIDATOR API to get it to work. I just wrapped the validator API (without hacks) and it works IF you export the META-INF.services package. Isn't that preferrable to hacking the validator API? /Bengt 2010/9/16 Willem Jiang <willem.ji...@gmail.com> > Oh, you need to make sure the bean validator API can find the implementor > jars in OSGi container. > ServiceMix did some work by introducing the service locator to search the > service from META-INF/services, and you may also need to hack the validator > API by using the locator to find the service from META-INF/services. > > If you like you can take a look at the code here[1] > > [1] https://svn.apache.org/repos/asf/servicemix/smx4/specs/trunk/locator > > Willem > > > On 9/16/10 2:39 PM, Bengt Rodehav wrote: > >> Willem, >> >> I ended up using my own wrapped version mostly for learning reasons. >> However, I had some problems with my wrapped version. I deployed it in the >> container but in runtime I got error messages saying that no default >> provider could be found. I then noticed that I hadn't exported the >> META-INF/services "package" from the bundle. When I did that, the error >> message disappeared and the validator worked. >> >> I then tested your (ServiceMix) wrapped version of the 4.0.2 version of >> Hibernate Validator. It seems to have the same problem. Maybe someone >> should >> look into this? >> >> /Bengt >> >> 2010/9/13 Bengt Rodehav<be...@rodehav.com> >> >> Thanks, I'll have a look, >>> >>> /Bengt >>> >>> 2010/9/13 Willem Jiang<willem.ji...@gmail.com> >>> >>> On 9/13/10 3:58 AM, Bengt Rodehav wrote: >>> >>>> >>>> Thanks Cristian, >>>>> >>>>> I kind of suspected that Servicemix had bundled this. Actually I ended >>>>> up >>>>> doing my own bundling anyway since I wanted to use the 4.1.0.Final >>>>> version. >>>>> Also wanted to see how easy/hard it was to accomplish. >>>>> >>>>> /Bengt >>>>> >>>>> >>>> I just created a patch[1] for the hibernate-validator bundle, you may >>>> take >>>> a look if you want use it. >>>> >>>> [1] https://issues.apache.org/activemq/browse/SMX4-592 >>>> >>>> Willem >>>> >>>> >>>> >>>> 2010/9/11 Christian Müller<christian.muel...@gmail.com> >>>>> >>>>> Hello Bengt! >>>>> >>>>>> >>>>>> Sorry, I overlooked it. >>>>>> Apache Servicemix provides the OSGI-fied version for us. You can find >>>>>> the >>>>>> released version 4.0.2 here [1] >>>>>> >>>>>> [1] >>>>>> >>>>>> >>>>>> >>>>>> http://repo2.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.hibernate-validator/4.0.2.GA_2/ >>>>>> >>>>>> Cheers, >>>>>> Christian >>>>>> >>>>>> On Sat, Sep 11, 2010 at 10:23 AM, Bengt Rodehav<be...@rodehav.com> >>>>>> wrote: >>>>>> >>>>>> Thanks for your reply Christian. >>>>>> >>>>>>> >>>>>>> However, the JAR you refer to isn't an OSGi bundle either. In fact I >>>>>>> >>>>>>> think >>>>>> >>>>>> its the publicly released jar from JBoss which I had problems with. I >>>>>>> >>>>>>> tried >>>>>> >>>>>> to use the OSGi wrapped version they use in Glassfish: >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> http://download.java.net/maven/2/org/glassfish/bean-validator/3.0-JBoss-4.0.2/bean-validator-3.0-JBoss-4.0.2.jar >>>>>> >>>>>> >>>>>>> But it turns out it requires the packages >>>>>>> "org.glassfish.api.naming.*" >>>>>>> >>>>>>> that >>>>>> >>>>>> I assume only exist in Glassfish. >>>>>>> >>>>>>> Related to the above, one also needs an OSGi bundle for the API: >>>>>>> javax.validation. Glassfish wraps it in the same jar I mentioned >>>>>>> above. >>>>>>> From >>>>>>> where does Camel take it? >>>>>>> >>>>>>> I don't quite understand how Camel can use the non-OSGi:fied version >>>>>>> of >>>>>>> hibernate-validator. Have you tried this deployed in an OSGi >>>>>>> container? >>>>>>> >>>>>>> /Bengt >>>>>>> >>>>>>> 2010/9/11 Christian Müller<christian.muel...@gmail.com> >>>>>>> >>>>>>> Hello Bengt, >>>>>>> >>>>>>>> >>>>>>>> we use the following on [1]. I think we could also update to 4.1.0. >>>>>>>> I >>>>>>>> opened >>>>>>>> a JIRA for it [2]. >>>>>>>> >>>>>>>> Hope this helps, >>>>>>>> Christian >>>>>>>> >>>>>>>> [1] >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> http://repository.jboss.org/nexus/content/groups/public/org/hibernate/hibernate-validator/4.0.2.GA/hibernate-validator-4.0.2.GA.jar >>>>>> >>>>>> [2] https://issues.apache.org/activemq/browse/CAMEL-3115 >>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Sat, Sep 11, 2010 at 1:07 AM, Bengt Rodehav<be...@rodehav.com> >>>>>>>> >>>>>>>> wrote: >>>>>>> >>>>>>> >>>>>>>> I''m experimenting with the Java Bean Validation API (JSR 303). I'm >>>>>>>> >>>>>>>>> >>>>>>>>> not >>>>>>>> >>>>>>> >>>>>> currently doing it with Camel but thought I might ask for help here >>>>>>> >>>>>>>> >>>>>>>>> anyway. >>>>>>>> >>>>>>>> >>>>>>>>> I'm deploying in an OSGi context and need OSGi bundles for both the >>>>>>>>> >>>>>>>>> API >>>>>>>> >>>>>>> >>>>>> (java.validation) and Hibernate's reference implementation >>>>>>> >>>>>>>> >>>>>>>>> (preferably >>>>>>>> >>>>>>> >>>>>> the >>>>>>> >>>>>>>> >>>>>>>> latest version which I believe is 4.1). I haven't been able to find >>>>>>>>> >>>>>>>>> one. >>>>>>>> >>>>>>> >>>>>>> The >>>>>>>> >>>>>>>>> only one I've found is bundled for Glassfish but has dependencies >>>>>>>>> on >>>>>>>>> Glassfish specific classes and therefore doesn't work outside >>>>>>>>> >>>>>>>>> Glassfish. >>>>>>>> >>>>>>> >>>>>>> >>>>>>>> Since Camel 2.4 contains the camel-bean-validator component I'm >>>>>>>>> >>>>>>>>> wondering >>>>>>>> >>>>>>> >>>>>>> if >>>>>>>> >>>>>>>>> anyone can tell me how this problem was solved in Camel. >>>>>>>>> >>>>>>>>> /Bengt >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >