I have built a simple app using 'merging' the Tomee example for
spring-data-proxy-meta example and rest-example-with-application. I rely
heavily on bean validation for my beans so I added the following property in
my jUnit tests
p.setProperty(BeanContext.USER_INTERCEPTOR_KEY,
BeanValidationAppendixInterceptor.class.getName());
And my spring data repository proxy throws an exception ... Removing the
prop disables the bean validation, but the spring data proxy works properly.
Here is a sample of the exception I get ...
Caused by: javax.validation.ValidationException: can't call method
validateParameters on
org.apache.bval.jsr303.extensions.MethodValidatorImpl@7e744f43
at
org.apache.openejb.bval.BeanValidationAppendixInterceptor.call(BeanValidationAppendixInterceptor.java:173)
at
org.apache.openejb.bval.BeanValidationAppendixInterceptor.aroundInvoke(BeanValidationAppendixInterceptor.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
at
org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
at
org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:192)
at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:173)
at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
at
org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:227)
at
org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:194)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:308)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:303)
at
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:92)
at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:322)
... 59 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at
org.apache.openejb.bval.BeanValidationAppendixInterceptor.call(BeanValidationAppendixInterceptor.java:170)
... 81 more
Caused by: javax.validation.ValidationException: Method public abstract
java.lang.Object
org.springframework.data.repository.CrudRepository.save(java.lang.Object)
doesn't belong to class interface foo.bar.repository.MyRepositoryDAO
at
org.apache.bval.jsr303.extensions.MethodValidatorImpl.validateParameters(MethodValidatorImpl.java:88)
... 86 more
Is this a bug, a limitation or something I might be doing wrong ? Any
workarounds, I really want to combine both things in my app.
Thanks in advance
Patrick
--
View this message in context:
http://tomee-openejb.979440.n4.nabble.com/Using-Spring-Data-and-bean-validation-in-Tomee-1-7-2-exception-tp4675192.html
Sent from the TomEE Users mailing list archive at Nabble.com.