You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Bengt Rodehav <be...@rodehav.com> on 2010/10/09 00:41:45 UTC
org.apache.servicemix.bundles.hibernate-validator: Unable to find a
default provider
I'm using the servicemix packaging of hibernate-validator and jsr303:
* <dependency>*
* <groupId>org.apache.servicemix.specs</groupId>*
* <artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
*
* <version>1.5.0</version>*
* </dependency>*
*
*
* <dependency>*
* <groupId>org.apache.servicemix.bundles</groupId>*
*
<artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
* <version>4.1.0.Final_1</version>*
* </dependency>*
I use the validator "manually" (not automatically via JPA) as follows:
*
*
> *public static Set<ConstraintViolation<?>> violations(Object theObject,
> Class<?>... theGroups)*
* throws ConstraintViolationException {*
* /**
* * Perform bean validation*
* */*
* ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
> // Throws exception*
* Validator validator = factory.getValidator();*
* return (Set) validator.validate(theObject, theGroups);*
* }*
The line that creates the ValidatorFactory throws an exception when called
from wihin OSGi:
javax.validation.ValidationException: Unable to find a default provider
at
> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
at
> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
at
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
When I run the same code outside of OSGi everything works. What am I doing
wrong?
The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to matter
what OSGi container I use. I've tried different versions of Felix and
Equinox but I get the same exception. I suspect I'm doing something wrong
but I cannot see what. Can someone help me out?
/Bengt
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to
find a default provider
Posted by Willem Jiang <wi...@gmail.com>.
The service locator will be activated if it is deployed into a OSGi
container. We just need to use the locator as a fall back, it's a common
solution in ServiceMix API wrapper.
On 10/9/10 3:44 PM, Johan Edstrom wrote:
> Willem,
>
> If that fix goes in, how do you suggest we mix/match this in code in camel?
> Is there a good pattern to check if we are "running" in osgi?
>
>
>
> On Oct 9, 2010, at 1:01 AM, Willem Jiang wrote:
>
>> Hi Bengt,
>>
>> I checked the code of servicemix jsr303 bundle, it just include the servicemix locator and doesn't use the service locator to find the provider for you.
>>
>> That explain why you get the below exception.
>>
>> javax.validation.ValidationException: Unable to find a default provider
>>
>> I will try to do a quick fix today.
>>
>>
>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>
>>> *<dependency>*
>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>> *
>>> *<version>1.5.0</version>*
>>> *</dependency>*
>>> *
>>> *
>>> *<dependency>*
>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>> *
>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>> *<version>4.1.0.Final_1</version>*
>>> *</dependency>*
>>>
>>> I use the validator "manually" (not automatically via JPA) as follows:
>>> *
>>> *
>>>
>>>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>>>> Class<?>... theGroups)*
>>>
>>> * throws ConstraintViolationException {*
>>>
>>> * /**
>>>
>>> * * Perform bean validation*
>>>
>>> * */*
>>>
>>> * ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
>>>> // Throws exception*
>>>
>>> * Validator validator = factory.getValidator();*
>>>
>>> * return (Set) validator.validate(theObject, theGroups);*
>>>
>>> * }*
>>>
>>>
>>> The line that creates the ValidatorFactory throws an exception when called
>>> from wihin OSGi:
>>>
>>> javax.validation.ValidationException: Unable to find a default provider
>>>
>>> at
>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>
>>> at
>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>
>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>
>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at
>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>
>>> at
>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at
>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>
>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>
>>> at java.security.AccessController.doPrivileged(Native Method)
>>>
>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>
>>> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>
>>> at
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>
>>> at
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>
>>> at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>
>>> at
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>>
>>>
>>> When I run the same code outside of OSGi everything works. What am I doing
>>> wrong?
>>>
>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to matter
>>> what OSGi container I use. I've tried different versions of Felix and
>>> Equinox but I get the same exception. I suspect I'm doing something wrong
>>> but I cannot see what. Can someone help me out?
>>>
>>> /Bengt
>>>
>>
>>
>> --
>> Willem
>> ----------------------------------
>> Open Source Integration: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: http://twitter.com/willemjiang
>
> Johan Edstrom
>
> joed@opennms.org
>
> They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
>
> Benjamin Franklin, Historical Review of Pennsylvania, 1759
>
>
>
>
>
>
--
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find a default provider
Posted by Johan Edstrom <se...@gmail.com>.
Willem,
If that fix goes in, how do you suggest we mix/match this in code in camel?
Is there a good pattern to check if we are "running" in osgi?
On Oct 9, 2010, at 1:01 AM, Willem Jiang wrote:
> Hi Bengt,
>
> I checked the code of servicemix jsr303 bundle, it just include the servicemix locator and doesn't use the service locator to find the provider for you.
>
> That explain why you get the below exception.
>
> javax.validation.ValidationException: Unable to find a default provider
>
> I will try to do a quick fix today.
>
>
> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>
>> *<dependency>*
>> *<groupId>org.apache.servicemix.specs</groupId>*
>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>> *
>> *<version>1.5.0</version>*
>> *</dependency>*
>> *
>> *
>> *<dependency>*
>> *<groupId>org.apache.servicemix.bundles</groupId>*
>> *
>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>> *<version>4.1.0.Final_1</version>*
>> *</dependency>*
>>
>> I use the validator "manually" (not automatically via JPA) as follows:
>> *
>> *
>>
>>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>>> Class<?>... theGroups)*
>>
>> * throws ConstraintViolationException {*
>>
>> * /**
>>
>> * * Perform bean validation*
>>
>> * */*
>>
>> * ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
>>> // Throws exception*
>>
>> * Validator validator = factory.getValidator();*
>>
>> * return (Set) validator.validate(theObject, theGroups);*
>>
>> * }*
>>
>>
>> The line that creates the ValidatorFactory throws an exception when called
>> from wihin OSGi:
>>
>> javax.validation.ValidationException: Unable to find a default provider
>>
>> at
>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>
>> at
>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>
>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>
>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>>
>> at
>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>
>> at
>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>>
>> at
>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>>
>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>
>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>>
>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>
>> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>
>> at
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>
>> at
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>
>> at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>
>> at
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>
>> at java.lang.Thread.run(Thread.java:619)
>>
>>
>> When I run the same code outside of OSGi everything works. What am I doing
>> wrong?
>>
>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to matter
>> what OSGi container I use. I've tried different versions of Felix and
>> Equinox but I get the same exception. I suspect I'm doing something wrong
>> but I cannot see what. Can someone help me out?
>>
>> /Bengt
>>
>
>
> --
> Willem
> ----------------------------------
> Open Source Integration: http://www.fusesource.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.javaeye.com (Chinese)
> Twitter: http://twitter.com/willemjiang
Johan Edstrom
joed@opennms.org
They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin, Historical Review of Pennsylvania, 1759
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
Very useful link.
Thanks,
/Bengt
2010/10/9 Freeman Fang <fr...@gmail.com>
> Btw, Guillaume have written an excellent blog[1] to explain why we need
> OSGiLocator and how it works for SPI mechanism in OSGi container.
>
> [1]http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html
>
> Freeman
>
> On 2010-10-9, at 下午7:36, Bengt Rodehav wrote:
>
> Willem,
>>
>> That explains it. I did look through the code and noticed the service
>> locator but couldn't understand how it was used....
>>
>> Thanks for your help Willem. I posted on the servicemix list to relieve
>> you
>> a bit since this problem should belong to Servicemix and not Camel (where
>> I
>> originally posted). But of course, you were here as well :-)
>>
>> /Bengt
>>
>> 2010/10/9 Willem Jiang <wi...@gmail.com>
>>
>> Hi Bengt,
>>>
>>> I checked the code of servicemix jsr303 bundle, it just include the
>>> servicemix locator and doesn't use the service locator to find the
>>> provider
>>> for you.
>>>
>>> That explain why you get the below exception.
>>>
>>>
>>> javax.validation.ValidationException: Unable to find a default provider
>>>
>>> I will try to do a quick fix today.
>>>
>>>
>>>
>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>>
>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>>
>>>> *<dependency>*
>>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>>> *
>>>> *<version>1.5.0</version>*
>>>> *</dependency>*
>>>> *
>>>> *
>>>> *<dependency>*
>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>>> *
>>>>
>>>>
>>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>>> *<version>4.1.0.Final_1</version>*
>>>> *</dependency>*
>>>>
>>>> I use the validator "manually" (not automatically via JPA) as follows:
>>>> *
>>>> *
>>>>
>>>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>>>>
>>>>> Class<?>... theGroups)*
>>>>>
>>>>>
>>>> * throws ConstraintViolationException {*
>>>>
>>>> * /**
>>>>
>>>> * * Perform bean validation*
>>>>
>>>> * */*
>>>>
>>>> * ValidatorFactory factory =
>>>> Validation.buildDefaultValidatorFactory();
>>>>
>>>> // Throws exception*
>>>>>
>>>>>
>>>> * Validator validator = factory.getValidator();*
>>>>
>>>> * return (Set) validator.validate(theObject, theGroups);*
>>>>
>>>> * }*
>>>>
>>>>
>>>> The line that creates the ValidatorFactory throws an exception when
>>>> called
>>>> from wihin OSGi:
>>>>
>>>> javax.validation.ValidationException: Unable to find a default provider
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>>
>>>>>
>>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>>
>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>>>
>>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>>>
>>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>>
>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>>
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>
>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>>
>>>> at
>>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>>
>>>>>
>>>> at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> When I run the same code outside of OSGi everything works. What am I
>>>> doing
>>>> wrong?
>>>>
>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>>> matter
>>>> what OSGi container I use. I've tried different versions of Felix and
>>>> Equinox but I get the same exception. I suspect I'm doing something
>>>> wrong
>>>> but I cannot see what. Can someone help me out?
>>>>
>>>> /Bengt
>>>>
>>>>
>>>>
>>> --
>>> Willem
>>> ----------------------------------
>>> Open Source Integration: http://www.fusesource.com
>>> Blog: http://willemjiang.blogspot.com (English)
>>> http://jnn.javaeye.com (Chinese)
>>> Twitter: http://twitter.com/willemjiang
>>>
>>>
>
> --
> Freeman Fang
>
> ------------------------
> blog: http://freemanfang.blogspot.com
> twitter: http://twitter.com/freemanfang
> Open Source SOA: http://fusesource.com
> Apache Servicemix:http://servicemix.apache.org
> Apache Cxf: http://cxf.apache.org
> Apache Karaf: http://karaf.apache.org
> Apache Felix: http://felix.apache.org
>
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find a default provider
Posted by Freeman Fang <fr...@gmail.com>.
Btw, Guillaume have written an excellent blog[1] to explain why we
need OSGiLocator and how it works for SPI mechanism in OSGi container.
[1]http://gnodet.blogspot.com/2008/05/jee-specs-in-osgi.html
Freeman
On 2010-10-9, at 下午7:36, Bengt Rodehav wrote:
> Willem,
>
> That explains it. I did look through the code and noticed the service
> locator but couldn't understand how it was used....
>
> Thanks for your help Willem. I posted on the servicemix list to
> relieve you
> a bit since this problem should belong to Servicemix and not Camel
> (where I
> originally posted). But of course, you were here as well :-)
>
> /Bengt
>
> 2010/10/9 Willem Jiang <wi...@gmail.com>
>
>> Hi Bengt,
>>
>> I checked the code of servicemix jsr303 bundle, it just include the
>> servicemix locator and doesn't use the service locator to find the
>> provider
>> for you.
>>
>> That explain why you get the below exception.
>>
>>
>> javax.validation.ValidationException: Unable to find a default
>> provider
>>
>> I will try to do a quick fix today.
>>
>>
>>
>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>
>>> I'm using the servicemix packaging of hibernate-validator and
>>> jsr303:
>>>
>>> *<dependency>*
>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</
>>> artifactId>
>>> *
>>> *<version>1.5.0</version>*
>>> *</dependency>*
>>> *
>>> *
>>> *<dependency>*
>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>> *
>>>
>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</
>>> artifactId>*
>>> *<version>4.1.0.Final_1</version>*
>>> *</dependency>*
>>>
>>> I use the validator "manually" (not automatically via JPA) as
>>> follows:
>>> *
>>> *
>>>
>>> *public static Set<ConstraintViolation<?>> violations(Object
>>> theObject,
>>>> Class<?>... theGroups)*
>>>>
>>>
>>> * throws ConstraintViolationException {*
>>>
>>> * /**
>>>
>>> * * Perform bean validation*
>>>
>>> * */*
>>>
>>> * ValidatorFactory factory =
>>> Validation.buildDefaultValidatorFactory();
>>>
>>>> // Throws exception*
>>>>
>>>
>>> * Validator validator = factory.getValidator();*
>>>
>>> * return (Set) validator.validate(theObject, theGroups);*
>>>
>>> * }*
>>>
>>>
>>> The line that creates the ValidatorFactory throws an exception when
>>> called
>>> from wihin OSGi:
>>>
>>> javax.validation.ValidationException: Unable to find a default
>>> provider
>>>
>>> at
>>>
>>>>
>>>> javax.validation.Validation
>>>> $GenericBootstrapImpl.configure(Validation.java:264)
>>>>
>>>
>>> at
>>>
>>>>
>>>> javax
>>>> .validation
>>>> .Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>
>>>
>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:
>>> 17)
>>>
>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>
>>>>
>>>> sun
>>>> .reflect
>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>
>>>
>>> at
>>>
>>>>
>>>> sun
>>>> .reflect
>>>> .DelegatingMethodAccessorImpl
>>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at
>>>
>>>>
>>>> org
>>>> .ops4j
>>>> .pax
>>>> .exam
>>>> .junit
>>>> .extender
>>>> .impl
>>>> .internal
>>>> .CallableTestMethodImpl
>>>> .injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>
>>>
>>> at
>>>
>>>>
>>>> org
>>>> .ops4j
>>>> .pax
>>>> .exam
>>>> .junit
>>>> .extender
>>>> .impl
>>>> .internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:
>>>> 105)
>>>>
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>
>>>>
>>>> sun
>>>> .reflect
>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>
>>>
>>> at
>>>
>>>>
>>>> sun
>>>> .reflect
>>>> .DelegatingMethodAccessorImpl
>>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at
>>>
>>>>
>>>> org
>>>> .ops4j
>>>> .pax
>>>> .exam
>>>> .rbc
>>>> .internal
>>>> .RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:
>>>> 80)
>>>>
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>
>>>>
>>>> sun
>>>> .reflect
>>>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>
>>>
>>> at
>>>
>>>>
>>>> sun
>>>> .reflect
>>>> .DelegatingMethodAccessorImpl
>>>> .invoke(DelegatingMethodAccessorImpl.java:25)
>>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:
>>> 305)
>>>
>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>
>>> at java.security.AccessController.doPrivileged(Native Method)
>>>
>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>
>>> at
>>> sun
>>> .rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:
>>> 535)
>>>
>>> at
>>>
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport
>>>> $ConnectionHandler.run0(TCPTransport.java:790)
>>>>
>>>
>>> at
>>>
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport
>>>> $ConnectionHandler.run(TCPTransport.java:649)
>>>>
>>>
>>> at
>>>
>>>>
>>>> java.util.concurrent.ThreadPoolExecutor
>>>> $Worker.runTask(ThreadPoolExecutor.java:885)
>>>>
>>>
>>> at
>>>
>>>>
>>>> java.util.concurrent.ThreadPoolExecutor
>>>> $Worker.run(ThreadPoolExecutor.java:907)
>>>>
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>>
>>>
>>> When I run the same code outside of OSGi everything works. What am
>>> I doing
>>> wrong?
>>>
>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>> matter
>>> what OSGi container I use. I've tried different versions of Felix
>>> and
>>> Equinox but I get the same exception. I suspect I'm doing
>>> something wrong
>>> but I cannot see what. Can someone help me out?
>>>
>>> /Bengt
>>>
>>>
>>
>> --
>> Willem
>> ----------------------------------
>> Open Source Integration: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: http://twitter.com/willemjiang
>>
--
Freeman Fang
------------------------
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Open Source SOA: http://fusesource.com
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
It sounds like I have to take a look at Apache Bean Validation then.
2010/11/19 jdart <jd...@vmware.com>
>
> FYI - I used a workaround similar to that detailed here:
>
> http://katastrophos.net/magnus/blog/2009/07/18/having-fun-with-jsr-303-beans-validation-and-osgi-spring-dm/
>
> (substituting the Apache provider for Hibernate) and it worked - but I
> think
> if the JSR-303 Validation code did the right thing this should not be
> necessary.
>
> > Out of curiosity, how would you compare Apache Bean Validation with
> > Hibernate validator - is it good?
>
> It has more functionality because it supports the method parameter and
> return value validation methods that are in an appendix of the JSR-303
> spec.
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/org-apache-servicemix-bundles-hibernate-validator-Unable-to-find-a-default-provider-tp3205442p3272801.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to
find a default provider
Posted by jdart <jd...@vmware.com>.
FYI - I used a workaround similar to that detailed here:
http://katastrophos.net/magnus/blog/2009/07/18/having-fun-with-jsr-303-beans-validation-and-osgi-spring-dm/
(substituting the Apache provider for Hibernate) and it worked - but I think
if the JSR-303 Validation code did the right thing this should not be
necessary.
> Out of curiosity, how would you compare Apache Bean Validation with
> Hibernate validator - is it good?
It has more functionality because it supports the method parameter and
return value validation methods that are in an appendix of the JSR-303 spec.
--
View this message in context: http://servicemix.396122.n5.nabble.com/org-apache-servicemix-bundles-hibernate-validator-Unable-to-find-a-default-provider-tp3205442p3272801.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
I've only used the hibernate validator (default) so this is a new area to
me.
Out of curiosity, how would you compare Apache Bean Validation with
Hibernate validator - is it good?
/Bengt
2010/11/18 jdart <jd...@vmware.com>
>
> I think this still may be broken in the OSGi environment in the case where
> you are configuring for a specific provider class (in my case I am using
> Apache Bean Validation). I am getting an exception at
>
>
> javax.validation.Validation$ProviderSpecificBootstrapImpl.configure(Validation.java:223)
>
> When I step through the code I see that it is calling the default
> validation
> provider resolver to get the list of validation providers - and neither the
> Osgi loading mechanism nor the services file mechanism is returning a
> provider.
>
> But it does not make sense to me that it is calling the resolver at all
> because in this part of the code it already has the specific validator
> class
> instance, so all it should have to do is instantiate it.
>
>
> --
> View this message in context:
> http://servicemix.396122.n5.nabble.com/org-apache-servicemix-bundles-hibernate-validator-Unable-to-find-a-default-provider-tp3205442p3271630.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to
find a default provider
Posted by jdart <jd...@vmware.com>.
I think this still may be broken in the OSGi environment in the case where
you are configuring for a specific provider class (in my case I am using
Apache Bean Validation). I am getting an exception at
javax.validation.Validation$ProviderSpecificBootstrapImpl.configure(Validation.java:223)
When I step through the code I see that it is calling the default validation
provider resolver to get the list of validation providers - and neither the
Osgi loading mechanism nor the services file mechanism is returning a
provider.
But it does not make sense to me that it is calling the resolver at all
because in this part of the code it already has the specific validator class
instance, so all it should have to do is instantiate it.
--
View this message in context: http://servicemix.396122.n5.nabble.com/org-apache-servicemix-bundles-hibernate-validator-Unable-to-find-a-default-provider-tp3205442p3271630.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
OK, thanks
/Bengt
2010/10/13 Gert Vanthienen <ge...@gmail.com>
> Bengt,
>
> We've just started discussing the 4.3.0 release on the dev list today,
> so we'll start planning and doing releases soon. This patch will be
> in the org.apache.servicemix.specs 1.6.0 release that's part of that
> ServiceMix release.
>
> Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
>
> On Wed, Oct 13, 2010 at 3:19 PM, Bengt Rodehav <be...@rodehav.com> wrote:
> > Thanks Gert,
> >
> > That makes sense. Hope to use the patch though. Do you know when a new
> > version will be published?
> >
> > /Bengt
> >
> > 2010/10/13 Gert Vanthienen <ge...@gmail.com>
> >
> >> Bengt,
> >>
> >> I think Willem's workaround shows you how to resolve the issue without
> >> relying on the patch. Instead of dynamically looking up the
> >> implementation using the META-INF/services files, the workaround
> >> configures the validator by just pointing to the correct
> >> implementation provider classes. With the fix however, the dynamic
> >> lookup will work fine in OSGi environments again.
> >>
> >> Regards,
> >>
> >> Gert Vanthienen
> >> ------------------------
> >> Open Source SOA: http://fusesource.com
> >> Blog: http://gertvanthienen.blogspot.com/
> >>
> >>
> >>
> >> On Tue, Oct 12, 2010 at 10:33 PM, Bengt Rodehav <be...@rodehav.com>
> wrote:
> >> > Willem,
> >> >
> >> > I tried the patch and it works for me. Still don't understand the
> >> workaround
> >> > though...
> >> >
> >> > /Bengt
> >> >
> >> > 2010/10/12 Bengt Rodehav <be...@rodehav.com>
> >> >
> >> >> Willem,
> >> >>
> >> >> I've verified (like you already had Willem) that the patch (I took
> the
> >> >> latest from SVN) works with my test case. Will try it on the rest of
> my
> >> code
> >> >> later tonight.
> >> >>
> >> >> Was a bit curious about the workaround that you described in the
> JIRA.
> >> What
> >> >> was it for?
> >> >>
> >> >> /Bengt
> >> >>
> >> >> 2010/10/12 Jean-Baptiste Onofré <jb...@nanthrax.net>
> >> >>
> >> >> Freeman already commited your patch.
> >> >>>
> >> >>> Regards
> >> >>> JB
> >> >>>
> >> >>>
> >> >>> On 10/12/2010 07:49 AM, Jean-Baptiste Onofré wrote:
> >> >>>
> >> >>>> Thanks Willem,
> >> >>>>
> >> >>>> I review the patch and commit.
> >> >>>>
> >> >>>> Regards
> >> >>>> JB
> >> >>>>
> >> >>>> On 10/12/2010 06:58 AM, Willem Jiang wrote:
> >> >>>>
> >> >>>>> Hi Bengt,
> >> >>>>>
> >> >>>>> I just created a JIRA[1] and submitted a patch which was tested
> with
> >> >>>>> your test case.
> >> >>>>>
> >> >>>>> I also added a workaround comment on the JIRA[1], Please check it
> >> out.
> >> >>>>>
> >> >>>>> [1]https://issues.apache.org/activemq/browse/SMX4-605
> >> >>>>>
> >> >>>>>
> >> >>>>> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
> >> >>>>>
> >> >>>>>> Willem,
> >> >>>>>>
> >> >>>>>> That explains it. I did look through the code and noticed the
> >> service
> >> >>>>>> locator but couldn't understand how it was used....
> >> >>>>>>
> >> >>>>>> Thanks for your help Willem. I posted on the servicemix list to
> >> >>>>>> relieve you
> >> >>>>>> a bit since this problem should belong to Servicemix and not
> Camel
> >> >>>>>> (where I
> >> >>>>>> originally posted). But of course, you were here as well :-)
> >> >>>>>>
> >> >>>>>> /Bengt
> >> >>>>>>
> >> >>>>>> 2010/10/9 Willem Jiang<wi...@gmail.com>
> >> >>>>>>
> >> >>>>>> Hi Bengt,
> >> >>>>>>>
> >> >>>>>>> I checked the code of servicemix jsr303 bundle, it just include
> the
> >> >>>>>>> servicemix locator and doesn't use the service locator to find
> the
> >> >>>>>>> provider
> >> >>>>>>> for you.
> >> >>>>>>>
> >> >>>>>>> That explain why you get the below exception.
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>> javax.validation.ValidationException: Unable to find a default
> >> >>>>>>> provider
> >> >>>>>>>
> >> >>>>>>> I will try to do a quick fix today.
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
> >> >>>>>>>
> >> >>>>>>> I'm using the servicemix packaging of hibernate-validator and
> >> jsr303:
> >> >>>>>>>>
> >> >>>>>>>> *<dependency>*
> >> >>>>>>>> *<groupId>org.apache.servicemix.specs</groupId>*
> >> >>>>>>>>
> >> >>>>>>>>
> >> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
> >> >>>>>>>> *
> >> >>>>>>>> *<version>1.5.0</version>*
> >> >>>>>>>> *</dependency>*
> >> >>>>>>>> *
> >> >>>>>>>> *
> >> >>>>>>>> *<dependency>*
> >> >>>>>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
> >> >>>>>>>> *
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>
> >>
> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>> *<version>4.1.0.Final_1</version>*
> >> >>>>>>>> *</dependency>*
> >> >>>>>>>>
> >> >>>>>>>> I use the validator "manually" (not automatically via JPA) as
> >> >>>>>>>> follows:
> >> >>>>>>>> *
> >> >>>>>>>> *
> >> >>>>>>>>
> >> >>>>>>>> *public static Set<ConstraintViolation<?>> violations(Object
> >> >>>>>>>> theObject,
> >> >>>>>>>>
> >> >>>>>>>>> Class<?>... theGroups)*
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> * throws ConstraintViolationException {*
> >> >>>>>>>>
> >> >>>>>>>> * /**
> >> >>>>>>>>
> >> >>>>>>>> * * Perform bean validation*
> >> >>>>>>>>
> >> >>>>>>>> * */*
> >> >>>>>>>>
> >> >>>>>>>> * ValidatorFactory factory =
> >> >>>>>>>> Validation.buildDefaultValidatorFactory();
> >> >>>>>>>>
> >> >>>>>>>> // Throws exception*
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> * Validator validator = factory.getValidator();*
> >> >>>>>>>>
> >> >>>>>>>> * return (Set) validator.validate(theObject, theGroups);*
> >> >>>>>>>>
> >> >>>>>>>> * }*
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>> The line that creates the ValidatorFactory throws an exception
> >> when
> >> >>>>>>>> called
> >> >>>>>>>> from wihin OSGi:
> >> >>>>>>>>
> >> >>>>>>>> javax.validation.ValidationException: Unable to find a default
> >> >>>>>>>> provider
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
> >> >>>>>>>>
> >> >>>>>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
> >> >>>>>>>>
> >> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
> >> >>>>>>>>
> >> >>>>>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
> >> >>>>>>>>
> >> >>>>>>>> at java.security.AccessController.doPrivileged(Native Method)
> >> >>>>>>>>
> >> >>>>>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>>>
> >> >>>>>>>> at java.lang.Thread.run(Thread.java:619)
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>> When I run the same code outside of OSGi everything works. What
> am
> >> I
> >> >>>>>>>> doing
> >> >>>>>>>> wrong?
> >> >>>>>>>>
> >> >>>>>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't
> seem
> >> to
> >> >>>>>>>> matter
> >> >>>>>>>> what OSGi container I use. I've tried different versions of
> Felix
> >> and
> >> >>>>>>>> Equinox but I get the same exception. I suspect I'm doing
> >> something
> >> >>>>>>>> wrong
> >> >>>>>>>> but I cannot see what. Can someone help me out?
> >> >>>>>>>>
> >> >>>>>>>> /Bengt
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>>>
> >> >>>>>>> --
> >> >>>>>>> Willem
> >> >>>>>>> ----------------------------------
> >> >>>>>>> Open Source Integration: http://www.fusesource.com
> >> >>>>>>> Blog: http://willemjiang.blogspot.com (English)
> >> >>>>>>> http://jnn.javaeye.com (Chinese)
> >> >>>>>>> Twitter: http://twitter.com/willemjiang
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>
> >> >>>>>
> >> >>>>>
> >> >>
> >> >
> >>
> >
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Gert Vanthienen <ge...@gmail.com>.
Bengt,
We've just started discussing the 4.3.0 release on the dev list today,
so we'll start planning and doing releases soon. This patch will be
in the org.apache.servicemix.specs 1.6.0 release that's part of that
ServiceMix release.
Regards,
Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/
On Wed, Oct 13, 2010 at 3:19 PM, Bengt Rodehav <be...@rodehav.com> wrote:
> Thanks Gert,
>
> That makes sense. Hope to use the patch though. Do you know when a new
> version will be published?
>
> /Bengt
>
> 2010/10/13 Gert Vanthienen <ge...@gmail.com>
>
>> Bengt,
>>
>> I think Willem's workaround shows you how to resolve the issue without
>> relying on the patch. Instead of dynamically looking up the
>> implementation using the META-INF/services files, the workaround
>> configures the validator by just pointing to the correct
>> implementation provider classes. With the fix however, the dynamic
>> lookup will work fine in OSGi environments again.
>>
>> Regards,
>>
>> Gert Vanthienen
>> ------------------------
>> Open Source SOA: http://fusesource.com
>> Blog: http://gertvanthienen.blogspot.com/
>>
>>
>>
>> On Tue, Oct 12, 2010 at 10:33 PM, Bengt Rodehav <be...@rodehav.com> wrote:
>> > Willem,
>> >
>> > I tried the patch and it works for me. Still don't understand the
>> workaround
>> > though...
>> >
>> > /Bengt
>> >
>> > 2010/10/12 Bengt Rodehav <be...@rodehav.com>
>> >
>> >> Willem,
>> >>
>> >> I've verified (like you already had Willem) that the patch (I took the
>> >> latest from SVN) works with my test case. Will try it on the rest of my
>> code
>> >> later tonight.
>> >>
>> >> Was a bit curious about the workaround that you described in the JIRA.
>> What
>> >> was it for?
>> >>
>> >> /Bengt
>> >>
>> >> 2010/10/12 Jean-Baptiste Onofré <jb...@nanthrax.net>
>> >>
>> >> Freeman already commited your patch.
>> >>>
>> >>> Regards
>> >>> JB
>> >>>
>> >>>
>> >>> On 10/12/2010 07:49 AM, Jean-Baptiste Onofré wrote:
>> >>>
>> >>>> Thanks Willem,
>> >>>>
>> >>>> I review the patch and commit.
>> >>>>
>> >>>> Regards
>> >>>> JB
>> >>>>
>> >>>> On 10/12/2010 06:58 AM, Willem Jiang wrote:
>> >>>>
>> >>>>> Hi Bengt,
>> >>>>>
>> >>>>> I just created a JIRA[1] and submitted a patch which was tested with
>> >>>>> your test case.
>> >>>>>
>> >>>>> I also added a workaround comment on the JIRA[1], Please check it
>> out.
>> >>>>>
>> >>>>> [1]https://issues.apache.org/activemq/browse/SMX4-605
>> >>>>>
>> >>>>>
>> >>>>> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
>> >>>>>
>> >>>>>> Willem,
>> >>>>>>
>> >>>>>> That explains it. I did look through the code and noticed the
>> service
>> >>>>>> locator but couldn't understand how it was used....
>> >>>>>>
>> >>>>>> Thanks for your help Willem. I posted on the servicemix list to
>> >>>>>> relieve you
>> >>>>>> a bit since this problem should belong to Servicemix and not Camel
>> >>>>>> (where I
>> >>>>>> originally posted). But of course, you were here as well :-)
>> >>>>>>
>> >>>>>> /Bengt
>> >>>>>>
>> >>>>>> 2010/10/9 Willem Jiang<wi...@gmail.com>
>> >>>>>>
>> >>>>>> Hi Bengt,
>> >>>>>>>
>> >>>>>>> I checked the code of servicemix jsr303 bundle, it just include the
>> >>>>>>> servicemix locator and doesn't use the service locator to find the
>> >>>>>>> provider
>> >>>>>>> for you.
>> >>>>>>>
>> >>>>>>> That explain why you get the below exception.
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> javax.validation.ValidationException: Unable to find a default
>> >>>>>>> provider
>> >>>>>>>
>> >>>>>>> I will try to do a quick fix today.
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>> >>>>>>>
>> >>>>>>> I'm using the servicemix packaging of hibernate-validator and
>> jsr303:
>> >>>>>>>>
>> >>>>>>>> *<dependency>*
>> >>>>>>>> *<groupId>org.apache.servicemix.specs</groupId>*
>> >>>>>>>>
>> >>>>>>>>
>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>> >>>>>>>> *
>> >>>>>>>> *<version>1.5.0</version>*
>> >>>>>>>> *</dependency>*
>> >>>>>>>> *
>> >>>>>>>> *
>> >>>>>>>> *<dependency>*
>> >>>>>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>> >>>>>>>> *
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> *<version>4.1.0.Final_1</version>*
>> >>>>>>>> *</dependency>*
>> >>>>>>>>
>> >>>>>>>> I use the validator "manually" (not automatically via JPA) as
>> >>>>>>>> follows:
>> >>>>>>>> *
>> >>>>>>>> *
>> >>>>>>>>
>> >>>>>>>> *public static Set<ConstraintViolation<?>> violations(Object
>> >>>>>>>> theObject,
>> >>>>>>>>
>> >>>>>>>>> Class<?>... theGroups)*
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> * throws ConstraintViolationException {*
>> >>>>>>>>
>> >>>>>>>> * /**
>> >>>>>>>>
>> >>>>>>>> * * Perform bean validation*
>> >>>>>>>>
>> >>>>>>>> * */*
>> >>>>>>>>
>> >>>>>>>> * ValidatorFactory factory =
>> >>>>>>>> Validation.buildDefaultValidatorFactory();
>> >>>>>>>>
>> >>>>>>>> // Throws exception*
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> * Validator validator = factory.getValidator();*
>> >>>>>>>>
>> >>>>>>>> * return (Set) validator.validate(theObject, theGroups);*
>> >>>>>>>>
>> >>>>>>>> * }*
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> The line that creates the ValidatorFactory throws an exception
>> when
>> >>>>>>>> called
>> >>>>>>>> from wihin OSGi:
>> >>>>>>>>
>> >>>>>>>> javax.validation.ValidationException: Unable to find a default
>> >>>>>>>> provider
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>> >>>>>>>>
>> >>>>>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>> >>>>>>>>
>> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>> >>>>>>>>
>> >>>>>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>> >>>>>>>>
>> >>>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>> >>>>>>>>
>> >>>>>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>>>
>> >>>>>>>> at java.lang.Thread.run(Thread.java:619)
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>> When I run the same code outside of OSGi everything works. What am
>> I
>> >>>>>>>> doing
>> >>>>>>>> wrong?
>> >>>>>>>>
>> >>>>>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem
>> to
>> >>>>>>>> matter
>> >>>>>>>> what OSGi container I use. I've tried different versions of Felix
>> and
>> >>>>>>>> Equinox but I get the same exception. I suspect I'm doing
>> something
>> >>>>>>>> wrong
>> >>>>>>>> but I cannot see what. Can someone help me out?
>> >>>>>>>>
>> >>>>>>>> /Bengt
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>>>
>> >>>>>>> --
>> >>>>>>> Willem
>> >>>>>>> ----------------------------------
>> >>>>>>> Open Source Integration: http://www.fusesource.com
>> >>>>>>> Blog: http://willemjiang.blogspot.com (English)
>> >>>>>>> http://jnn.javaeye.com (Chinese)
>> >>>>>>> Twitter: http://twitter.com/willemjiang
>> >>>>>>>
>> >>>>>>>
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>
>> >
>>
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks Gert,
That makes sense. Hope to use the patch though. Do you know when a new
version will be published?
/Bengt
2010/10/13 Gert Vanthienen <ge...@gmail.com>
> Bengt,
>
> I think Willem's workaround shows you how to resolve the issue without
> relying on the patch. Instead of dynamically looking up the
> implementation using the META-INF/services files, the workaround
> configures the validator by just pointing to the correct
> implementation provider classes. With the fix however, the dynamic
> lookup will work fine in OSGi environments again.
>
> Regards,
>
> Gert Vanthienen
> ------------------------
> Open Source SOA: http://fusesource.com
> Blog: http://gertvanthienen.blogspot.com/
>
>
>
> On Tue, Oct 12, 2010 at 10:33 PM, Bengt Rodehav <be...@rodehav.com> wrote:
> > Willem,
> >
> > I tried the patch and it works for me. Still don't understand the
> workaround
> > though...
> >
> > /Bengt
> >
> > 2010/10/12 Bengt Rodehav <be...@rodehav.com>
> >
> >> Willem,
> >>
> >> I've verified (like you already had Willem) that the patch (I took the
> >> latest from SVN) works with my test case. Will try it on the rest of my
> code
> >> later tonight.
> >>
> >> Was a bit curious about the workaround that you described in the JIRA.
> What
> >> was it for?
> >>
> >> /Bengt
> >>
> >> 2010/10/12 Jean-Baptiste Onofré <jb...@nanthrax.net>
> >>
> >> Freeman already commited your patch.
> >>>
> >>> Regards
> >>> JB
> >>>
> >>>
> >>> On 10/12/2010 07:49 AM, Jean-Baptiste Onofré wrote:
> >>>
> >>>> Thanks Willem,
> >>>>
> >>>> I review the patch and commit.
> >>>>
> >>>> Regards
> >>>> JB
> >>>>
> >>>> On 10/12/2010 06:58 AM, Willem Jiang wrote:
> >>>>
> >>>>> Hi Bengt,
> >>>>>
> >>>>> I just created a JIRA[1] and submitted a patch which was tested with
> >>>>> your test case.
> >>>>>
> >>>>> I also added a workaround comment on the JIRA[1], Please check it
> out.
> >>>>>
> >>>>> [1]https://issues.apache.org/activemq/browse/SMX4-605
> >>>>>
> >>>>>
> >>>>> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
> >>>>>
> >>>>>> Willem,
> >>>>>>
> >>>>>> That explains it. I did look through the code and noticed the
> service
> >>>>>> locator but couldn't understand how it was used....
> >>>>>>
> >>>>>> Thanks for your help Willem. I posted on the servicemix list to
> >>>>>> relieve you
> >>>>>> a bit since this problem should belong to Servicemix and not Camel
> >>>>>> (where I
> >>>>>> originally posted). But of course, you were here as well :-)
> >>>>>>
> >>>>>> /Bengt
> >>>>>>
> >>>>>> 2010/10/9 Willem Jiang<wi...@gmail.com>
> >>>>>>
> >>>>>> Hi Bengt,
> >>>>>>>
> >>>>>>> I checked the code of servicemix jsr303 bundle, it just include the
> >>>>>>> servicemix locator and doesn't use the service locator to find the
> >>>>>>> provider
> >>>>>>> for you.
> >>>>>>>
> >>>>>>> That explain why you get the below exception.
> >>>>>>>
> >>>>>>>
> >>>>>>> javax.validation.ValidationException: Unable to find a default
> >>>>>>> provider
> >>>>>>>
> >>>>>>> I will try to do a quick fix today.
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
> >>>>>>>
> >>>>>>> I'm using the servicemix packaging of hibernate-validator and
> jsr303:
> >>>>>>>>
> >>>>>>>> *<dependency>*
> >>>>>>>> *<groupId>org.apache.servicemix.specs</groupId>*
> >>>>>>>>
> >>>>>>>>
> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
> >>>>>>>> *
> >>>>>>>> *<version>1.5.0</version>*
> >>>>>>>> *</dependency>*
> >>>>>>>> *
> >>>>>>>> *
> >>>>>>>> *<dependency>*
> >>>>>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
> >>>>>>>> *
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> *<version>4.1.0.Final_1</version>*
> >>>>>>>> *</dependency>*
> >>>>>>>>
> >>>>>>>> I use the validator "manually" (not automatically via JPA) as
> >>>>>>>> follows:
> >>>>>>>> *
> >>>>>>>> *
> >>>>>>>>
> >>>>>>>> *public static Set<ConstraintViolation<?>> violations(Object
> >>>>>>>> theObject,
> >>>>>>>>
> >>>>>>>>> Class<?>... theGroups)*
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> * throws ConstraintViolationException {*
> >>>>>>>>
> >>>>>>>> * /**
> >>>>>>>>
> >>>>>>>> * * Perform bean validation*
> >>>>>>>>
> >>>>>>>> * */*
> >>>>>>>>
> >>>>>>>> * ValidatorFactory factory =
> >>>>>>>> Validation.buildDefaultValidatorFactory();
> >>>>>>>>
> >>>>>>>> // Throws exception*
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> * Validator validator = factory.getValidator();*
> >>>>>>>>
> >>>>>>>> * return (Set) validator.validate(theObject, theGroups);*
> >>>>>>>>
> >>>>>>>> * }*
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> The line that creates the ValidatorFactory throws an exception
> when
> >>>>>>>> called
> >>>>>>>> from wihin OSGi:
> >>>>>>>>
> >>>>>>>> javax.validation.ValidationException: Unable to find a default
> >>>>>>>> provider
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
> >>>>>>>>
> >>>>>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
> >>>>>>>>
> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
> >>>>>>>>
> >>>>>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
> >>>>>>>>
> >>>>>>>> at java.security.AccessController.doPrivileged(Native Method)
> >>>>>>>>
> >>>>>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>>>
> >>>>>>>> at java.lang.Thread.run(Thread.java:619)
> >>>>>>>>
> >>>>>>>>
> >>>>>>>> When I run the same code outside of OSGi everything works. What am
> I
> >>>>>>>> doing
> >>>>>>>> wrong?
> >>>>>>>>
> >>>>>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem
> to
> >>>>>>>> matter
> >>>>>>>> what OSGi container I use. I've tried different versions of Felix
> and
> >>>>>>>> Equinox but I get the same exception. I suspect I'm doing
> something
> >>>>>>>> wrong
> >>>>>>>> but I cannot see what. Can someone help me out?
> >>>>>>>>
> >>>>>>>> /Bengt
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>> --
> >>>>>>> Willem
> >>>>>>> ----------------------------------
> >>>>>>> Open Source Integration: http://www.fusesource.com
> >>>>>>> Blog: http://willemjiang.blogspot.com (English)
> >>>>>>> http://jnn.javaeye.com (Chinese)
> >>>>>>> Twitter: http://twitter.com/willemjiang
> >>>>>>>
> >>>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>
> >
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Gert Vanthienen <ge...@gmail.com>.
Bengt,
I think Willem's workaround shows you how to resolve the issue without
relying on the patch. Instead of dynamically looking up the
implementation using the META-INF/services files, the workaround
configures the validator by just pointing to the correct
implementation provider classes. With the fix however, the dynamic
lookup will work fine in OSGi environments again.
Regards,
Gert Vanthienen
------------------------
Open Source SOA: http://fusesource.com
Blog: http://gertvanthienen.blogspot.com/
On Tue, Oct 12, 2010 at 10:33 PM, Bengt Rodehav <be...@rodehav.com> wrote:
> Willem,
>
> I tried the patch and it works for me. Still don't understand the workaround
> though...
>
> /Bengt
>
> 2010/10/12 Bengt Rodehav <be...@rodehav.com>
>
>> Willem,
>>
>> I've verified (like you already had Willem) that the patch (I took the
>> latest from SVN) works with my test case. Will try it on the rest of my code
>> later tonight.
>>
>> Was a bit curious about the workaround that you described in the JIRA. What
>> was it for?
>>
>> /Bengt
>>
>> 2010/10/12 Jean-Baptiste Onofré <jb...@nanthrax.net>
>>
>> Freeman already commited your patch.
>>>
>>> Regards
>>> JB
>>>
>>>
>>> On 10/12/2010 07:49 AM, Jean-Baptiste Onofré wrote:
>>>
>>>> Thanks Willem,
>>>>
>>>> I review the patch and commit.
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 10/12/2010 06:58 AM, Willem Jiang wrote:
>>>>
>>>>> Hi Bengt,
>>>>>
>>>>> I just created a JIRA[1] and submitted a patch which was tested with
>>>>> your test case.
>>>>>
>>>>> I also added a workaround comment on the JIRA[1], Please check it out.
>>>>>
>>>>> [1]https://issues.apache.org/activemq/browse/SMX4-605
>>>>>
>>>>>
>>>>> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
>>>>>
>>>>>> Willem,
>>>>>>
>>>>>> That explains it. I did look through the code and noticed the service
>>>>>> locator but couldn't understand how it was used....
>>>>>>
>>>>>> Thanks for your help Willem. I posted on the servicemix list to
>>>>>> relieve you
>>>>>> a bit since this problem should belong to Servicemix and not Camel
>>>>>> (where I
>>>>>> originally posted). But of course, you were here as well :-)
>>>>>>
>>>>>> /Bengt
>>>>>>
>>>>>> 2010/10/9 Willem Jiang<wi...@gmail.com>
>>>>>>
>>>>>> Hi Bengt,
>>>>>>>
>>>>>>> I checked the code of servicemix jsr303 bundle, it just include the
>>>>>>> servicemix locator and doesn't use the service locator to find the
>>>>>>> provider
>>>>>>> for you.
>>>>>>>
>>>>>>> That explain why you get the below exception.
>>>>>>>
>>>>>>>
>>>>>>> javax.validation.ValidationException: Unable to find a default
>>>>>>> provider
>>>>>>>
>>>>>>> I will try to do a quick fix today.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>>>>>>
>>>>>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>>>>>>
>>>>>>>> *<dependency>*
>>>>>>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>>>>>>>
>>>>>>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>>>>>>> *
>>>>>>>> *<version>1.5.0</version>*
>>>>>>>> *</dependency>*
>>>>>>>> *
>>>>>>>> *
>>>>>>>> *<dependency>*
>>>>>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>>>>>>> *
>>>>>>>>
>>>>>>>>
>>>>>>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>>>>>>>
>>>>>>>>
>>>>>>>> *<version>4.1.0.Final_1</version>*
>>>>>>>> *</dependency>*
>>>>>>>>
>>>>>>>> I use the validator "manually" (not automatically via JPA) as
>>>>>>>> follows:
>>>>>>>> *
>>>>>>>> *
>>>>>>>>
>>>>>>>> *public static Set<ConstraintViolation<?>> violations(Object
>>>>>>>> theObject,
>>>>>>>>
>>>>>>>>> Class<?>... theGroups)*
>>>>>>>>>
>>>>>>>>>
>>>>>>>> * throws ConstraintViolationException {*
>>>>>>>>
>>>>>>>> * /**
>>>>>>>>
>>>>>>>> * * Perform bean validation*
>>>>>>>>
>>>>>>>> * */*
>>>>>>>>
>>>>>>>> * ValidatorFactory factory =
>>>>>>>> Validation.buildDefaultValidatorFactory();
>>>>>>>>
>>>>>>>> // Throws exception*
>>>>>>>>>
>>>>>>>>>
>>>>>>>> * Validator validator = factory.getValidator();*
>>>>>>>>
>>>>>>>> * return (Set) validator.validate(theObject, theGroups);*
>>>>>>>>
>>>>>>>> * }*
>>>>>>>>
>>>>>>>>
>>>>>>>> The line that creates the ValidatorFactory throws an exception when
>>>>>>>> called
>>>>>>>> from wihin OSGi:
>>>>>>>>
>>>>>>>> javax.validation.ValidationException: Unable to find a default
>>>>>>>> provider
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>> validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>>>>>>
>>>>>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>>>>>>
>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>>
>>>>>>>> at
>>>>>>>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>>>>>>
>>>>>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>>>>>>
>>>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>>>>
>>>>>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>>>>
>>>>>>>>
>>>>>>>> When I run the same code outside of OSGi everything works. What am I
>>>>>>>> doing
>>>>>>>> wrong?
>>>>>>>>
>>>>>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>>>>>>> matter
>>>>>>>> what OSGi container I use. I've tried different versions of Felix and
>>>>>>>> Equinox but I get the same exception. I suspect I'm doing something
>>>>>>>> wrong
>>>>>>>> but I cannot see what. Can someone help me out?
>>>>>>>>
>>>>>>>> /Bengt
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> Willem
>>>>>>> ----------------------------------
>>>>>>> Open Source Integration: http://www.fusesource.com
>>>>>>> Blog: http://willemjiang.blogspot.com (English)
>>>>>>> http://jnn.javaeye.com (Chinese)
>>>>>>> Twitter: http://twitter.com/willemjiang
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
Willem,
I tried the patch and it works for me. Still don't understand the workaround
though...
/Bengt
2010/10/12 Bengt Rodehav <be...@rodehav.com>
> Willem,
>
> I've verified (like you already had Willem) that the patch (I took the
> latest from SVN) works with my test case. Will try it on the rest of my code
> later tonight.
>
> Was a bit curious about the workaround that you described in the JIRA. What
> was it for?
>
> /Bengt
>
> 2010/10/12 Jean-Baptiste Onofré <jb...@nanthrax.net>
>
> Freeman already commited your patch.
>>
>> Regards
>> JB
>>
>>
>> On 10/12/2010 07:49 AM, Jean-Baptiste Onofré wrote:
>>
>>> Thanks Willem,
>>>
>>> I review the patch and commit.
>>>
>>> Regards
>>> JB
>>>
>>> On 10/12/2010 06:58 AM, Willem Jiang wrote:
>>>
>>>> Hi Bengt,
>>>>
>>>> I just created a JIRA[1] and submitted a patch which was tested with
>>>> your test case.
>>>>
>>>> I also added a workaround comment on the JIRA[1], Please check it out.
>>>>
>>>> [1]https://issues.apache.org/activemq/browse/SMX4-605
>>>>
>>>>
>>>> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
>>>>
>>>>> Willem,
>>>>>
>>>>> That explains it. I did look through the code and noticed the service
>>>>> locator but couldn't understand how it was used....
>>>>>
>>>>> Thanks for your help Willem. I posted on the servicemix list to
>>>>> relieve you
>>>>> a bit since this problem should belong to Servicemix and not Camel
>>>>> (where I
>>>>> originally posted). But of course, you were here as well :-)
>>>>>
>>>>> /Bengt
>>>>>
>>>>> 2010/10/9 Willem Jiang<wi...@gmail.com>
>>>>>
>>>>> Hi Bengt,
>>>>>>
>>>>>> I checked the code of servicemix jsr303 bundle, it just include the
>>>>>> servicemix locator and doesn't use the service locator to find the
>>>>>> provider
>>>>>> for you.
>>>>>>
>>>>>> That explain why you get the below exception.
>>>>>>
>>>>>>
>>>>>> javax.validation.ValidationException: Unable to find a default
>>>>>> provider
>>>>>>
>>>>>> I will try to do a quick fix today.
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>>>>>
>>>>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>>>>>
>>>>>>> *<dependency>*
>>>>>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>>>>>>
>>>>>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>>>>>> *
>>>>>>> *<version>1.5.0</version>*
>>>>>>> *</dependency>*
>>>>>>> *
>>>>>>> *
>>>>>>> *<dependency>*
>>>>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>>>>>> *
>>>>>>>
>>>>>>>
>>>>>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>>>>>>
>>>>>>>
>>>>>>> *<version>4.1.0.Final_1</version>*
>>>>>>> *</dependency>*
>>>>>>>
>>>>>>> I use the validator "manually" (not automatically via JPA) as
>>>>>>> follows:
>>>>>>> *
>>>>>>> *
>>>>>>>
>>>>>>> *public static Set<ConstraintViolation<?>> violations(Object
>>>>>>> theObject,
>>>>>>>
>>>>>>>> Class<?>... theGroups)*
>>>>>>>>
>>>>>>>>
>>>>>>> * throws ConstraintViolationException {*
>>>>>>>
>>>>>>> * /**
>>>>>>>
>>>>>>> * * Perform bean validation*
>>>>>>>
>>>>>>> * */*
>>>>>>>
>>>>>>> * ValidatorFactory factory =
>>>>>>> Validation.buildDefaultValidatorFactory();
>>>>>>>
>>>>>>> // Throws exception*
>>>>>>>>
>>>>>>>>
>>>>>>> * Validator validator = factory.getValidator();*
>>>>>>>
>>>>>>> * return (Set) validator.validate(theObject, theGroups);*
>>>>>>>
>>>>>>> * }*
>>>>>>>
>>>>>>>
>>>>>>> The line that creates the ValidatorFactory throws an exception when
>>>>>>> called
>>>>>>> from wihin OSGi:
>>>>>>>
>>>>>>> javax.validation.ValidationException: Unable to find a default
>>>>>>> provider
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>> validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>>>>>
>>>>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>>>>>
>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>>
>>>>>>> at
>>>>>>> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>>>>>
>>>>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>>>>>
>>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>>>
>>>>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>>>
>>>>>>>
>>>>>>> When I run the same code outside of OSGi everything works. What am I
>>>>>>> doing
>>>>>>> wrong?
>>>>>>>
>>>>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>>>>>> matter
>>>>>>> what OSGi container I use. I've tried different versions of Felix and
>>>>>>> Equinox but I get the same exception. I suspect I'm doing something
>>>>>>> wrong
>>>>>>> but I cannot see what. Can someone help me out?
>>>>>>>
>>>>>>> /Bengt
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> --
>>>>>> Willem
>>>>>> ----------------------------------
>>>>>> Open Source Integration: http://www.fusesource.com
>>>>>> Blog: http://willemjiang.blogspot.com (English)
>>>>>> http://jnn.javaeye.com (Chinese)
>>>>>> Twitter: http://twitter.com/willemjiang
>>>>>>
>>>>>>
>>>>>
>>>>
>>>>
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
Willem,
I've verified (like you already had Willem) that the patch (I took the
latest from SVN) works with my test case. Will try it on the rest of my code
later tonight.
Was a bit curious about the workaround that you described in the JIRA. What
was it for?
/Bengt
2010/10/12 Jean-Baptiste Onofré <jb...@nanthrax.net>
> Freeman already commited your patch.
>
> Regards
> JB
>
>
> On 10/12/2010 07:49 AM, Jean-Baptiste Onofré wrote:
>
>> Thanks Willem,
>>
>> I review the patch and commit.
>>
>> Regards
>> JB
>>
>> On 10/12/2010 06:58 AM, Willem Jiang wrote:
>>
>>> Hi Bengt,
>>>
>>> I just created a JIRA[1] and submitted a patch which was tested with
>>> your test case.
>>>
>>> I also added a workaround comment on the JIRA[1], Please check it out.
>>>
>>> [1]https://issues.apache.org/activemq/browse/SMX4-605
>>>
>>>
>>> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
>>>
>>>> Willem,
>>>>
>>>> That explains it. I did look through the code and noticed the service
>>>> locator but couldn't understand how it was used....
>>>>
>>>> Thanks for your help Willem. I posted on the servicemix list to
>>>> relieve you
>>>> a bit since this problem should belong to Servicemix and not Camel
>>>> (where I
>>>> originally posted). But of course, you were here as well :-)
>>>>
>>>> /Bengt
>>>>
>>>> 2010/10/9 Willem Jiang<wi...@gmail.com>
>>>>
>>>> Hi Bengt,
>>>>>
>>>>> I checked the code of servicemix jsr303 bundle, it just include the
>>>>> servicemix locator and doesn't use the service locator to find the
>>>>> provider
>>>>> for you.
>>>>>
>>>>> That explain why you get the below exception.
>>>>>
>>>>>
>>>>> javax.validation.ValidationException: Unable to find a default provider
>>>>>
>>>>> I will try to do a quick fix today.
>>>>>
>>>>>
>>>>>
>>>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>>>>
>>>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>>>>
>>>>>> *<dependency>*
>>>>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>>>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>>>>> *
>>>>>> *<version>1.5.0</version>*
>>>>>> *</dependency>*
>>>>>> *
>>>>>> *
>>>>>> *<dependency>*
>>>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>>>>> *
>>>>>>
>>>>>>
>>>>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>>>>>
>>>>>>
>>>>>> *<version>4.1.0.Final_1</version>*
>>>>>> *</dependency>*
>>>>>>
>>>>>> I use the validator "manually" (not automatically via JPA) as follows:
>>>>>> *
>>>>>> *
>>>>>>
>>>>>> *public static Set<ConstraintViolation<?>> violations(Object
>>>>>> theObject,
>>>>>>
>>>>>>> Class<?>... theGroups)*
>>>>>>>
>>>>>>>
>>>>>> * throws ConstraintViolationException {*
>>>>>>
>>>>>> * /**
>>>>>>
>>>>>> * * Perform bean validation*
>>>>>>
>>>>>> * */*
>>>>>>
>>>>>> * ValidatorFactory factory =
>>>>>> Validation.buildDefaultValidatorFactory();
>>>>>>
>>>>>> // Throws exception*
>>>>>>>
>>>>>>>
>>>>>> * Validator validator = factory.getValidator();*
>>>>>>
>>>>>> * return (Set) validator.validate(theObject, theGroups);*
>>>>>>
>>>>>> * }*
>>>>>>
>>>>>>
>>>>>> The line that creates the ValidatorFactory throws an exception when
>>>>>> called
>>>>>> from wihin OSGi:
>>>>>>
>>>>>> javax.validation.ValidationException: Unable to find a default
>>>>>> provider
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>>>>
>>>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>>>>
>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>>
>>>>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>>>>
>>>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>>>>
>>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>>
>>>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>>>>
>>>>>> at
>>>>>>
>>>>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>>>>
>>>>>>
>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>>
>>>>>>
>>>>>> When I run the same code outside of OSGi everything works. What am I
>>>>>> doing
>>>>>> wrong?
>>>>>>
>>>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>>>>> matter
>>>>>> what OSGi container I use. I've tried different versions of Felix and
>>>>>> Equinox but I get the same exception. I suspect I'm doing something
>>>>>> wrong
>>>>>> but I cannot see what. Can someone help me out?
>>>>>>
>>>>>> /Bengt
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> Willem
>>>>> ----------------------------------
>>>>> Open Source Integration: http://www.fusesource.com
>>>>> Blog: http://willemjiang.blogspot.com (English)
>>>>> http://jnn.javaeye.com (Chinese)
>>>>> Twitter: http://twitter.com/willemjiang
>>>>>
>>>>>
>>>>
>>>
>>>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to
find a default provider
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Freeman already commited your patch.
Regards
JB
On 10/12/2010 07:49 AM, Jean-Baptiste Onofré wrote:
> Thanks Willem,
>
> I review the patch and commit.
>
> Regards
> JB
>
> On 10/12/2010 06:58 AM, Willem Jiang wrote:
>> Hi Bengt,
>>
>> I just created a JIRA[1] and submitted a patch which was tested with
>> your test case.
>>
>> I also added a workaround comment on the JIRA[1], Please check it out.
>>
>> [1]https://issues.apache.org/activemq/browse/SMX4-605
>>
>>
>> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
>>> Willem,
>>>
>>> That explains it. I did look through the code and noticed the service
>>> locator but couldn't understand how it was used....
>>>
>>> Thanks for your help Willem. I posted on the servicemix list to
>>> relieve you
>>> a bit since this problem should belong to Servicemix and not Camel
>>> (where I
>>> originally posted). But of course, you were here as well :-)
>>>
>>> /Bengt
>>>
>>> 2010/10/9 Willem Jiang<wi...@gmail.com>
>>>
>>>> Hi Bengt,
>>>>
>>>> I checked the code of servicemix jsr303 bundle, it just include the
>>>> servicemix locator and doesn't use the service locator to find the
>>>> provider
>>>> for you.
>>>>
>>>> That explain why you get the below exception.
>>>>
>>>>
>>>> javax.validation.ValidationException: Unable to find a default provider
>>>>
>>>> I will try to do a quick fix today.
>>>>
>>>>
>>>>
>>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>>>
>>>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>>>
>>>>> *<dependency>*
>>>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>>>> *
>>>>> *<version>1.5.0</version>*
>>>>> *</dependency>*
>>>>> *
>>>>> *
>>>>> *<dependency>*
>>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>>>> *
>>>>>
>>>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>>>>
>>>>>
>>>>> *<version>4.1.0.Final_1</version>*
>>>>> *</dependency>*
>>>>>
>>>>> I use the validator "manually" (not automatically via JPA) as follows:
>>>>> *
>>>>> *
>>>>>
>>>>> *public static Set<ConstraintViolation<?>> violations(Object
>>>>> theObject,
>>>>>> Class<?>... theGroups)*
>>>>>>
>>>>>
>>>>> * throws ConstraintViolationException {*
>>>>>
>>>>> * /**
>>>>>
>>>>> * * Perform bean validation*
>>>>>
>>>>> * */*
>>>>>
>>>>> * ValidatorFactory factory =
>>>>> Validation.buildDefaultValidatorFactory();
>>>>>
>>>>>> // Throws exception*
>>>>>>
>>>>>
>>>>> * Validator validator = factory.getValidator();*
>>>>>
>>>>> * return (Set) validator.validate(theObject, theGroups);*
>>>>>
>>>>> * }*
>>>>>
>>>>>
>>>>> The line that creates the ValidatorFactory throws an exception when
>>>>> called
>>>>> from wihin OSGi:
>>>>>
>>>>> javax.validation.ValidationException: Unable to find a default
>>>>> provider
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>>>
>>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>>>
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>>
>>>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>>>
>>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>>>
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>>
>>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>>>
>>>>> at
>>>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>>>
>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at
>>>>>
>>>>>>
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> at java.lang.Thread.run(Thread.java:619)
>>>>>
>>>>>
>>>>> When I run the same code outside of OSGi everything works. What am I
>>>>> doing
>>>>> wrong?
>>>>>
>>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>>>> matter
>>>>> what OSGi container I use. I've tried different versions of Felix and
>>>>> Equinox but I get the same exception. I suspect I'm doing something
>>>>> wrong
>>>>> but I cannot see what. Can someone help me out?
>>>>>
>>>>> /Bengt
>>>>>
>>>>>
>>>>
>>>> --
>>>> Willem
>>>> ----------------------------------
>>>> Open Source Integration: http://www.fusesource.com
>>>> Blog: http://willemjiang.blogspot.com (English)
>>>> http://jnn.javaeye.com (Chinese)
>>>> Twitter: http://twitter.com/willemjiang
>>>>
>>>
>>
>>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to
find a default provider
Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks Willem,
I review the patch and commit.
Regards
JB
On 10/12/2010 06:58 AM, Willem Jiang wrote:
> Hi Bengt,
>
> I just created a JIRA[1] and submitted a patch which was tested with
> your test case.
>
> I also added a workaround comment on the JIRA[1], Please check it out.
>
> [1]https://issues.apache.org/activemq/browse/SMX4-605
>
>
> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
>> Willem,
>>
>> That explains it. I did look through the code and noticed the service
>> locator but couldn't understand how it was used....
>>
>> Thanks for your help Willem. I posted on the servicemix list to
>> relieve you
>> a bit since this problem should belong to Servicemix and not Camel
>> (where I
>> originally posted). But of course, you were here as well :-)
>>
>> /Bengt
>>
>> 2010/10/9 Willem Jiang<wi...@gmail.com>
>>
>>> Hi Bengt,
>>>
>>> I checked the code of servicemix jsr303 bundle, it just include the
>>> servicemix locator and doesn't use the service locator to find the
>>> provider
>>> for you.
>>>
>>> That explain why you get the below exception.
>>>
>>>
>>> javax.validation.ValidationException: Unable to find a default provider
>>>
>>> I will try to do a quick fix today.
>>>
>>>
>>>
>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>>
>>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>>
>>>> *<dependency>*
>>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>>> *
>>>> *<version>1.5.0</version>*
>>>> *</dependency>*
>>>> *
>>>> *
>>>> *<dependency>*
>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>>> *
>>>>
>>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>>>
>>>> *<version>4.1.0.Final_1</version>*
>>>> *</dependency>*
>>>>
>>>> I use the validator "manually" (not automatically via JPA) as follows:
>>>> *
>>>> *
>>>>
>>>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>>>>> Class<?>... theGroups)*
>>>>>
>>>>
>>>> * throws ConstraintViolationException {*
>>>>
>>>> * /**
>>>>
>>>> * * Perform bean validation*
>>>>
>>>> * */*
>>>>
>>>> * ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
>>>>
>>>>> // Throws exception*
>>>>>
>>>>
>>>> * Validator validator = factory.getValidator();*
>>>>
>>>> * return (Set) validator.validate(theObject, theGroups);*
>>>>
>>>> * }*
>>>>
>>>>
>>>> The line that creates the ValidatorFactory throws an exception when
>>>> called
>>>> from wihin OSGi:
>>>>
>>>> javax.validation.ValidationException: Unable to find a default provider
>>>>
>>>> at
>>>>
>>>>>
>>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>>>
>>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>>
>>>>>
>>>>
>>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>>
>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>>
>>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>>>
>>>>>
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>>>
>>>>>
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>>
>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>>
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>
>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>>
>>>> at
>>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>>>
>>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>>>
>>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>>
>>>>>
>>>>
>>>> at
>>>>
>>>>>
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>>
>>>>>
>>>>
>>>> at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> When I run the same code outside of OSGi everything works. What am I
>>>> doing
>>>> wrong?
>>>>
>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>>> matter
>>>> what OSGi container I use. I've tried different versions of Felix and
>>>> Equinox but I get the same exception. I suspect I'm doing something
>>>> wrong
>>>> but I cannot see what. Can someone help me out?
>>>>
>>>> /Bengt
>>>>
>>>>
>>>
>>> --
>>> Willem
>>> ----------------------------------
>>> Open Source Integration: http://www.fusesource.com
>>> Blog: http://willemjiang.blogspot.com (English)
>>> http://jnn.javaeye.com (Chinese)
>>> Twitter: http://twitter.com/willemjiang
>>>
>>
>
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks Willem,
Will check it out tonight or tomorrow (I have a "meeting" day today...).
/Bengt
2010/10/12 Willem Jiang <wi...@gmail.com>
> Hi Bengt,
>
> I just created a JIRA[1] and submitted a patch which was tested with your
> test case.
>
> I also added a workaround comment on the JIRA[1], Please check it out.
>
> [1]https://issues.apache.org/activemq/browse/SMX4-605
>
>
>
> On 10/9/10 7:36 PM, Bengt Rodehav wrote:
>
>> Willem,
>>
>> That explains it. I did look through the code and noticed the service
>> locator but couldn't understand how it was used....
>>
>> Thanks for your help Willem. I posted on the servicemix list to relieve
>> you
>> a bit since this problem should belong to Servicemix and not Camel (where
>> I
>> originally posted). But of course, you were here as well :-)
>>
>> /Bengt
>>
>> 2010/10/9 Willem Jiang<wi...@gmail.com>
>>
>> Hi Bengt,
>>>
>>> I checked the code of servicemix jsr303 bundle, it just include the
>>> servicemix locator and doesn't use the service locator to find the
>>> provider
>>> for you.
>>>
>>> That explain why you get the below exception.
>>>
>>>
>>> javax.validation.ValidationException: Unable to find a default provider
>>>
>>> I will try to do a quick fix today.
>>>
>>>
>>>
>>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>>
>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>>
>>>> *<dependency>*
>>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>>> *
>>>> *<version>1.5.0</version>*
>>>> *</dependency>*
>>>> *
>>>> *
>>>> *<dependency>*
>>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>>> *
>>>>
>>>>
>>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>>> *<version>4.1.0.Final_1</version>*
>>>> *</dependency>*
>>>>
>>>> I use the validator "manually" (not automatically via JPA) as follows:
>>>> *
>>>> *
>>>>
>>>> *public static Set<ConstraintViolation<?>> violations(Object
>>>> theObject,
>>>>
>>>>> Class<?>... theGroups)*
>>>>>
>>>>>
>>>> * throws ConstraintViolationException {*
>>>>
>>>> * /**
>>>>
>>>> * * Perform bean validation*
>>>>
>>>> * */*
>>>>
>>>> * ValidatorFactory factory =
>>>> Validation.buildDefaultValidatorFactory();
>>>>
>>>> // Throws exception*
>>>>>
>>>>>
>>>> * Validator validator = factory.getValidator();*
>>>>
>>>> * return (Set) validator.validate(theObject, theGroups);*
>>>>
>>>> * }*
>>>>
>>>>
>>>> The line that creates the ValidatorFactory throws an exception when
>>>> called
>>>> from wihin OSGi:
>>>>
>>>> javax.validation.ValidationException: Unable to find a default provider
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>>
>>>>>
>>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>>
>>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>>>
>>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>>>
>>>>>
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>>
>>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>>
>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>
>>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>>
>>>> at
>>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>>
>>>>>
>>>> at
>>>>
>>>>
>>>>>
>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>>
>>>>>
>>>> at java.lang.Thread.run(Thread.java:619)
>>>>
>>>>
>>>> When I run the same code outside of OSGi everything works. What am I
>>>> doing
>>>> wrong?
>>>>
>>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>>> matter
>>>> what OSGi container I use. I've tried different versions of Felix and
>>>> Equinox but I get the same exception. I suspect I'm doing something
>>>> wrong
>>>> but I cannot see what. Can someone help me out?
>>>>
>>>> /Bengt
>>>>
>>>>
>>>>
>>> --
>>> Willem
>>> ----------------------------------
>>> Open Source Integration: http://www.fusesource.com
>>> Blog: http://willemjiang.blogspot.com (English)
>>> http://jnn.javaeye.com (Chinese)
>>> Twitter: http://twitter.com/willemjiang
>>>
>>>
>>
>
> --
> Willem
> ----------------------------------
> Open Source Integration: http://www.fusesource.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.javaeye.com (Chinese)
> Twitter: http://twitter.com/willemjiang
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to
find a default provider
Posted by Willem Jiang <wi...@gmail.com>.
Hi Bengt,
I just created a JIRA[1] and submitted a patch which was tested with
your test case.
I also added a workaround comment on the JIRA[1], Please check it out.
[1]https://issues.apache.org/activemq/browse/SMX4-605
On 10/9/10 7:36 PM, Bengt Rodehav wrote:
> Willem,
>
> That explains it. I did look through the code and noticed the service
> locator but couldn't understand how it was used....
>
> Thanks for your help Willem. I posted on the servicemix list to relieve you
> a bit since this problem should belong to Servicemix and not Camel (where I
> originally posted). But of course, you were here as well :-)
>
> /Bengt
>
> 2010/10/9 Willem Jiang<wi...@gmail.com>
>
>> Hi Bengt,
>>
>> I checked the code of servicemix jsr303 bundle, it just include the
>> servicemix locator and doesn't use the service locator to find the provider
>> for you.
>>
>> That explain why you get the below exception.
>>
>>
>> javax.validation.ValidationException: Unable to find a default provider
>>
>> I will try to do a quick fix today.
>>
>>
>>
>> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>>
>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>
>>> *<dependency>*
>>> *<groupId>org.apache.servicemix.specs</groupId>*
>>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>> *
>>> *<version>1.5.0</version>*
>>> *</dependency>*
>>> *
>>> *
>>> *<dependency>*
>>> *<groupId>org.apache.servicemix.bundles</groupId>*
>>> *
>>>
>>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>> *<version>4.1.0.Final_1</version>*
>>> *</dependency>*
>>>
>>> I use the validator "manually" (not automatically via JPA) as follows:
>>> *
>>> *
>>>
>>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>>>> Class<?>... theGroups)*
>>>>
>>>
>>> * throws ConstraintViolationException {*
>>>
>>> * /**
>>>
>>> * * Perform bean validation*
>>>
>>> * */*
>>>
>>> * ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
>>>
>>>> // Throws exception*
>>>>
>>>
>>> * Validator validator = factory.getValidator();*
>>>
>>> * return (Set) validator.validate(theObject, theGroups);*
>>>
>>> * }*
>>>
>>>
>>> The line that creates the ValidatorFactory throws an exception when
>>> called
>>> from wihin OSGi:
>>>
>>> javax.validation.ValidationException: Unable to find a default provider
>>>
>>> at
>>>
>>>>
>>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>>
>>>
>>> at
>>>
>>>>
>>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>>
>>>
>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>
>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>
>>>
>>> at
>>>
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at
>>>
>>>>
>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>>
>>>
>>> at
>>>
>>>>
>>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>>
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>
>>>
>>> at
>>>
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at
>>>
>>>>
>>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>>
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>
>>>>
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>
>>>
>>> at
>>>
>>>>
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>
>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>
>>> at java.security.AccessController.doPrivileged(Native Method)
>>>
>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>
>>> at
>>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>
>>> at
>>>
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>>
>>>
>>> at
>>>
>>>>
>>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>>
>>>
>>> at
>>>
>>>>
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>>
>>>
>>> at
>>>
>>>>
>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>>
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>>
>>>
>>> When I run the same code outside of OSGi everything works. What am I doing
>>> wrong?
>>>
>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>>> matter
>>> what OSGi container I use. I've tried different versions of Felix and
>>> Equinox but I get the same exception. I suspect I'm doing something wrong
>>> but I cannot see what. Can someone help me out?
>>>
>>> /Bengt
>>>
>>>
>>
>> --
>> Willem
>> ----------------------------------
>> Open Source Integration: http://www.fusesource.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.javaeye.com (Chinese)
>> Twitter: http://twitter.com/willemjiang
>>
>
--
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
Willem,
That explains it. I did look through the code and noticed the service
locator but couldn't understand how it was used....
Thanks for your help Willem. I posted on the servicemix list to relieve you
a bit since this problem should belong to Servicemix and not Camel (where I
originally posted). But of course, you were here as well :-)
/Bengt
2010/10/9 Willem Jiang <wi...@gmail.com>
> Hi Bengt,
>
> I checked the code of servicemix jsr303 bundle, it just include the
> servicemix locator and doesn't use the service locator to find the provider
> for you.
>
> That explain why you get the below exception.
>
>
> javax.validation.ValidationException: Unable to find a default provider
>
> I will try to do a quick fix today.
>
>
>
> On 10/9/10 6:41 AM, Bengt Rodehav wrote:
>
>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>
>> *<dependency>*
>> *<groupId>org.apache.servicemix.specs</groupId>*
>> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>> *
>> *<version>1.5.0</version>*
>> *</dependency>*
>> *
>> *
>> *<dependency>*
>> *<groupId>org.apache.servicemix.bundles</groupId>*
>> *
>>
>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>> *<version>4.1.0.Final_1</version>*
>> *</dependency>*
>>
>> I use the validator "manually" (not automatically via JPA) as follows:
>> *
>> *
>>
>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>>> Class<?>... theGroups)*
>>>
>>
>> * throws ConstraintViolationException {*
>>
>> * /**
>>
>> * * Perform bean validation*
>>
>> * */*
>>
>> * ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
>>
>>> // Throws exception*
>>>
>>
>> * Validator validator = factory.getValidator();*
>>
>> * return (Set) validator.validate(theObject, theGroups);*
>>
>> * }*
>>
>>
>> The line that creates the ValidatorFactory throws an exception when
>> called
>> from wihin OSGi:
>>
>> javax.validation.ValidationException: Unable to find a default provider
>>
>> at
>>
>>>
>>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>
>>
>> at
>>
>>>
>>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>
>>
>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>
>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> at
>>
>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>
>> at
>>
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>>
>> at
>>
>>>
>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>
>>
>> at
>>
>>>
>>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> at
>>
>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>
>> at
>>
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>>
>> at
>>
>>>
>>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>
>> at
>>
>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>
>> at
>>
>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>>
>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>
>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>>
>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>
>> at
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>
>> at
>>
>>>
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>
>>
>> at
>>
>>>
>>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>
>>
>> at
>>
>>>
>>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>
>>
>> at
>>
>>>
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>
>>
>> at java.lang.Thread.run(Thread.java:619)
>>
>>
>> When I run the same code outside of OSGi everything works. What am I doing
>> wrong?
>>
>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>> matter
>> what OSGi container I use. I've tried different versions of Felix and
>> Equinox but I get the same exception. I suspect I'm doing something wrong
>> but I cannot see what. Can someone help me out?
>>
>> /Bengt
>>
>>
>
> --
> Willem
> ----------------------------------
> Open Source Integration: http://www.fusesource.com
> Blog: http://willemjiang.blogspot.com (English)
> http://jnn.javaeye.com (Chinese)
> Twitter: http://twitter.com/willemjiang
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to
find a default provider
Posted by Willem Jiang <wi...@gmail.com>.
Hi Bengt,
I checked the code of servicemix jsr303 bundle, it just include the
servicemix locator and doesn't use the service locator to find the
provider for you.
That explain why you get the below exception.
javax.validation.ValidationException: Unable to find a default provider
I will try to do a quick fix today.
On 10/9/10 6:41 AM, Bengt Rodehav wrote:
> I'm using the servicemix packaging of hibernate-validator and jsr303:
>
> *<dependency>*
> *<groupId>org.apache.servicemix.specs</groupId>*
> *<artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
> *
> *<version>1.5.0</version>*
> *</dependency>*
> *
> *
> *<dependency>*
> *<groupId>org.apache.servicemix.bundles</groupId>*
> *
> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
> *<version>4.1.0.Final_1</version>*
> *</dependency>*
>
> I use the validator "manually" (not automatically via JPA) as follows:
> *
> *
>
>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>> Class<?>... theGroups)*
>
> * throws ConstraintViolationException {*
>
> * /**
>
> * * Perform bean validation*
>
> * */*
>
> * ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
>> // Throws exception*
>
> * Validator validator = factory.getValidator();*
>
> * return (Set) validator.validate(theObject, theGroups);*
>
> * }*
>
>
> The line that creates the ValidatorFactory throws an exception when called
> from wihin OSGi:
>
> javax.validation.ValidationException: Unable to find a default provider
>
> at
>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>
> at
>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>
> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>
> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at
>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>
> at
>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at
>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>
> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>
> at java.security.AccessController.doPrivileged(Native Method)
>
> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>
> at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>
> at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>
> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>
> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>
> at java.lang.Thread.run(Thread.java:619)
>
>
> When I run the same code outside of OSGi everything works. What am I doing
> wrong?
>
> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to matter
> what OSGi container I use. I've tried different versions of Felix and
> Equinox but I get the same exception. I suspect I'm doing something wrong
> but I cannot see what. Can someone help me out?
>
> /Bengt
>
--
Willem
----------------------------------
Open Source Integration: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: http://twitter.com/willemjiang
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find a default provider
Posted by Johan Edstrom <se...@gmail.com>.
Bengt,
Basically the problem is - JSR303 (also describes this) that it is up to the container to
provide a Validator factory lookup, the bundle does this from the bundles classpath.
In my test I "fudge" that by using a fragment, this attaches to the classpath of the bundle doing the lookup.
I.e my suggestion is that you either provide a Service lookup factory method or try a fragment.
provision(newBundle()
.add("META-INF/validation.xml", BeanValidatorTest.class.getClassLoader().getResource("META-INF/validation.xml"))
.add("constraints-car.xml", BeanValidatorTest.class.getClassLoader().getResource("constraints-car.xml"))
.set(Constants.BUNDLE_SYMBOLICNAME, "validation-fragment")
.set(Constants.FRAGMENT_HOST, "org.apache.servicemix.specs.jsr303-api-1.0.0")
.build(withBnd())),
Basically I built a new fragment bundle where I added the XML file needed so that the Hibernate validator could do the lookup.
/je
On Oct 9, 2010, at 12:58 AM, Bengt Rodehav wrote:
> Thanks for your reply Johan.
>
> However, I'm not sure what you mean. Do you use the OSGi wrappers for
> hibernate-validator and jsr303 from ServiceMix like I do? Do you access the
> validation API from within OSGi like me or do you do it in a different way?
>
> /Bengt
>
> 2010/10/9 Johan Edstrom <se...@gmail.com>
>
>> If you look under seijoed on github, I have a test there I started working
>> on where I attach the validation. XML as a fragment to hit the right
>> classloaders.
>>
>> I think that test is only missing student in a separate bundle both
>> validation and camel can see.
>>
>>
>> On Oct 8, 2010, at 15:41, Bengt Rodehav <be...@rodehav.com> wrote:
>>
>>> I'm using the servicemix packaging of hibernate-validator and jsr303:
>>>
>>> * <dependency>*
>>> * <groupId>org.apache.servicemix.specs</groupId>*
>>> *
>> <artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
>>> *
>>> * <version>1.5.0</version>*
>>> * </dependency>*
>>> *
>>> *
>>> * <dependency>*
>>> * <groupId>org.apache.servicemix.bundles</groupId>*
>>> *
>>>
>> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
>>> * <version>4.1.0.Final_1</version>*
>>> * </dependency>*
>>>
>>> I use the validator "manually" (not automatically via JPA) as follows:
>>> *
>>> *
>>>
>>>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>>>> Class<?>... theGroups)*
>>>
>>> * throws ConstraintViolationException {*
>>>
>>> * /**
>>>
>>> * * Perform bean validation*
>>>
>>> * */*
>>>
>>> * ValidatorFactory factory =
>> Validation.buildDefaultValidatorFactory();
>>>> // Throws exception*
>>>
>>> * Validator validator = factory.getValidator();*
>>>
>>> * return (Set) validator.validate(theObject, theGroups);*
>>>
>>> * }*
>>>
>>>
>>> The line that creates the ValidatorFactory throws an exception when
>> called
>>> from wihin OSGi:
>>>
>>> javax.validation.ValidationException: Unable to find a default provider
>>>
>>> at
>>>>
>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>>>
>>> at
>>>>
>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>>>
>>> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>>>
>>> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at
>>>>
>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>>>
>>> at
>>>>
>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at
>>>>
>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>>>
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>
>>> at
>>>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:597)
>>>
>>> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>>>
>>> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>>>
>>> at java.security.AccessController.doPrivileged(Native Method)
>>>
>>> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>>>
>>> at
>> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>>>
>>> at
>>>>
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>>>
>>> at
>>>>
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>>>
>>> at
>>>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>>>
>>> at
>>>>
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>>>
>>> at java.lang.Thread.run(Thread.java:619)
>>>
>>>
>>> When I run the same code outside of OSGi everything works. What am I
>> doing
>>> wrong?
>>>
>>> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
>> matter
>>> what OSGi container I use. I've tried different versions of Felix and
>>> Equinox but I get the same exception. I suspect I'm doing something wrong
>>> but I cannot see what. Can someone help me out?
>>>
>>> /Bengt
>>
Johan Edstrom
joed@opennms.org
They that can give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.
Benjamin Franklin, Historical Review of Pennsylvania, 1759
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find
a default provider
Posted by Bengt Rodehav <be...@rodehav.com>.
Thanks for your reply Johan.
However, I'm not sure what you mean. Do you use the OSGi wrappers for
hibernate-validator and jsr303 from ServiceMix like I do? Do you access the
validation API from within OSGi like me or do you do it in a different way?
/Bengt
2010/10/9 Johan Edstrom <se...@gmail.com>
> If you look under seijoed on github, I have a test there I started working
> on where I attach the validation. XML as a fragment to hit the right
> classloaders.
>
> I think that test is only missing student in a separate bundle both
> validation and camel can see.
>
>
> On Oct 8, 2010, at 15:41, Bengt Rodehav <be...@rodehav.com> wrote:
>
> > I'm using the servicemix packaging of hibernate-validator and jsr303:
> >
> > * <dependency>*
> > * <groupId>org.apache.servicemix.specs</groupId>*
> > *
> <artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
> > *
> > * <version>1.5.0</version>*
> > * </dependency>*
> > *
> > *
> > * <dependency>*
> > * <groupId>org.apache.servicemix.bundles</groupId>*
> > *
> >
> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
> > * <version>4.1.0.Final_1</version>*
> > * </dependency>*
> >
> > I use the validator "manually" (not automatically via JPA) as follows:
> > *
> > *
> >
> >> *public static Set<ConstraintViolation<?>> violations(Object theObject,
> >> Class<?>... theGroups)*
> >
> > * throws ConstraintViolationException {*
> >
> > * /**
> >
> > * * Perform bean validation*
> >
> > * */*
> >
> > * ValidatorFactory factory =
> Validation.buildDefaultValidatorFactory();
> >> // Throws exception*
> >
> > * Validator validator = factory.getValidator();*
> >
> > * return (Set) validator.validate(theObject, theGroups);*
> >
> > * }*
> >
> >
> > The line that creates the ValidatorFactory throws an exception when
> called
> > from wihin OSGi:
> >
> > javax.validation.ValidationException: Unable to find a default provider
> >
> > at
> >>
> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
> >
> > at
> >>
> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
> >
> > at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
> >
> > at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
> >
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >
> > at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >
> > at java.lang.reflect.Method.invoke(Method.java:597)
> >
> > at
> >>
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
> >
> > at
> >>
> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
> >
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >
> > at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >
> > at java.lang.reflect.Method.invoke(Method.java:597)
> >
> > at
> >>
> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
> >
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >
> > at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >
> > at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >
> > at java.lang.reflect.Method.invoke(Method.java:597)
> >
> > at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
> >
> > at sun.rmi.transport.Transport$1.run(Transport.java:159)
> >
> > at java.security.AccessController.doPrivileged(Native Method)
> >
> > at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
> >
> > at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
> >
> > at
> >>
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
> >
> > at
> >>
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
> >
> > at
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> >
> > at
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> >
> > at java.lang.Thread.run(Thread.java:619)
> >
> >
> > When I run the same code outside of OSGi everything works. What am I
> doing
> > wrong?
> >
> > The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to
> matter
> > what OSGi container I use. I've tried different versions of Felix and
> > Equinox but I get the same exception. I suspect I'm doing something wrong
> > but I cannot see what. Can someone help me out?
> >
> > /Bengt
>
Re: org.apache.servicemix.bundles.hibernate-validator: Unable to find a default provider
Posted by Johan Edstrom <se...@gmail.com>.
If you look under seijoed on github, I have a test there I started working on where I attach the validation. XML as a fragment to hit the right classloaders.
I think that test is only missing student in a separate bundle both validation and camel can see.
On Oct 8, 2010, at 15:41, Bengt Rodehav <be...@rodehav.com> wrote:
> I'm using the servicemix packaging of hibernate-validator and jsr303:
>
> * <dependency>*
> * <groupId>org.apache.servicemix.specs</groupId>*
> * <artifactId>org.apache.servicemix.specs.jsr303-api-1.0.0</artifactId>
> *
> * <version>1.5.0</version>*
> * </dependency>*
> *
> *
> * <dependency>*
> * <groupId>org.apache.servicemix.bundles</groupId>*
> *
> <artifactId>org.apache.servicemix.bundles.hibernate-validator</artifactId>*
> * <version>4.1.0.Final_1</version>*
> * </dependency>*
>
> I use the validator "manually" (not automatically via JPA) as follows:
> *
> *
>
>> *public static Set<ConstraintViolation<?>> violations(Object theObject,
>> Class<?>... theGroups)*
>
> * throws ConstraintViolationException {*
>
> * /**
>
> * * Perform bean validation*
>
> * */*
>
> * ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
>> // Throws exception*
>
> * Validator validator = factory.getValidator();*
>
> * return (Set) validator.validate(theObject, theGroups);*
>
> * }*
>
>
> The line that creates the ValidatorFactory throws an exception when called
> from wihin OSGi:
>
> javax.validation.ValidationException: Unable to find a default provider
>
> at
>> javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
>
> at
>> javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
>
> at validator.test1.impl.ServiceOne.createEntityOne(ServiceOne.java:17)
>
> at validator.test.itest.OsgiTest.createTest(OsgiTest.java:29)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at
>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.injectContextAndInvoke(CallableTestMethodImpl.java:143)
>
> at
>> org.ops4j.pax.exam.junit.extender.impl.internal.CallableTestMethodImpl.call(CallableTestMethodImpl.java:105)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at
>> org.ops4j.pax.exam.rbc.internal.RemoteBundleContextImpl.remoteCall(RemoteBundleContextImpl.java:80)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
>
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
>
> at sun.rmi.transport.Transport$1.run(Transport.java:159)
>
> at java.security.AccessController.doPrivileged(Native Method)
>
> at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
>
> at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
>
> at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
>
> at
>> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
>
> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
>
> at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
>
> at java.lang.Thread.run(Thread.java:619)
>
>
> When I run the same code outside of OSGi everything works. What am I doing
> wrong?
>
> The test above used Pax-Exam with Felix 3.0.2 but it doesn't seem to matter
> what OSGi container I use. I've tried different versions of Felix and
> Equinox but I get the same exception. I suspect I'm doing something wrong
> but I cannot see what. Can someone help me out?
>
> /Bengt