https://github.com/apache/bval/blob/trunk/bval-jsr/src/main/java/org/apache/bval/cdi/BValExtension.java#L251 should do it
Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2016-06-02 23:09 GMT+02:00 Shultz, Dmitry <dmitry_shu...@kaltire.com>: > Makes sense, Thanks Romain. > > Although I reported that my test is working it's only partially true. > I have two test classes so far, one is annotated with > @RunWith(CdiTestRunner.class) - it runs without problem, another is > annotated with @RunWith(CamelCdiRunner.class) fails with this exception: > > org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied > dependencies for type Validator with qualifiers @Default > at injection point [UnbackedAnnotatedField] @Inject private > org.apache.bval.cdi.BValInterceptor.validator > at org.apache.bval.cdi.BValInterceptor.validator(BValInterceptor.java:0) > > at > org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:359) > at > org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:281) > at > org.jboss.weld.bootstrap.Validator.validateInterceptor(Validator.java:556) > at > org.jboss.weld.bootstrap.ConcurrentValidator$2.doWork(ConcurrentValidator.java:85) > at > org.jboss.weld.bootstrap.ConcurrentValidator$2.doWork(ConcurrentValidator.java:83) > at > org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63) > at > org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56) > at java.util.concurrent.FutureTask.run(FutureTask.java:266) > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > at java.lang.Thread.run(Thread.java:745) > > I checked the bval dependency and it is bval-jsr-1.1.1.jar. > BValInterceptor requires javax.validation.Validator to be injected, but it > looks like there is no producer. I can create producer in my test, but I'm > not sure instance of what class to produce. > > Dmitry > > > -----Original Message----- > From: Romain Manni-Bucau [mailto:rmannibu...@gmail.com] > Sent: June-01-16 11:33 PM > To: users@camel.apache.org > Subject: Re: camel-test-cdi + OpenEJB fails on weld dependency? > > Yes, classpath deployment of openejb/tomee uses: > 1- not excluded jars (exclusions.list) > 2- jars with beans.xml or scoped beans are scanned (default mode of CDI > 1.1) > 3- packages incldued in scan.xml if existing > > Note to answer your javaee-api question, tomee still provides its own > shade at org.apache.tomee:javaee-api:7.0 but since EE 7 this is a bit less > impacting for standalone case. > > > > Romain Manni-Bucau > @rmannibucau <https://twitter.com/rmannibucau> | Blog < > http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> > | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber < > http://www.tomitribe.com> | JavaEE Factory < > https://javaeefactory-rmannibucau.rhcloud.com> > > 2016-06-02 3:34 GMT+02:00 dimas <dmitry_shu...@kaltire.com>: > > > Included beans.xml in the resources/META-INF/ and it works now :) > > > > Cheers, > > Dmitry > > > > > > From: Shultz, Dmitry > > Sent: June-01-16 3:49 PM > > To: 'Romain Manni-Bucau [via Camel]' < > > ml-node+s465427n5783367...@n5.nabble.com> > > Subject: RE: camel-test-cdi + OpenEJB fails on weld dependency? > > > > Thanks Romain, > > > > changing from org.apache.openejb.javaee-api:6.0-6 to > > javax.javaee-api:7.0 fixed the exception. > > > > Now test is running, however there is another problem (I'm having some > > real fun here:) - it can't find any cdi bean, not sure if it's > > related to the javaee groupId change from org.apache.openejb to javax. > > For example I have factory returning custom application scoped > > CamelContext, but CamelContext injected into the test is the default one. > > The same problem is there when I use test with > > @RunWith(CdiTestRunner.class) - it can't find any bean annotated with > > @Named. > > > > Is there any special place where test cdi runtime is looking for > > beans.xml? Or maybe there is somewhere maven available > > org.apache.openejb.javaee-api:7.0? > > > > Cheers, > > Dmitry > > > > From: Romain Manni-Bucau [via Camel] [mailto: > > ml-node+s465427n5783367...@n5.nabble.com] > > Sent: June-01-16 1:07 PM > > To: Shultz, Dmitry <dmitry_shu...@kaltire.com<mailto: > > dmitry_shu...@kaltire.com>> > > Subject: Re: camel-test-cdi + OpenEJB fails on weld dependency? > > > > Hi, > > > > about JSF: you can exclude deltaspike extension - camel shouldn't > > require it AFAIK about bval: ensure you use javaee-api or bval 1.1 > > API. In your case you have a bval 1.0 API in the classpath. > > > > > > Romain Manni-Bucau > > @rmannibucau <https://twitter.com/rmannibucau> | Blog > > <http://rmannibucau.wordpress.com> | Github < > > https://github.com/rmannibucau> | LinkedIn > > <https://www.linkedin.com/in/rmannibucau> | Tomitriber > > <http://www.tomitribe.com> | JavaEE Factory > > <https://javaeefactory-rmannibucau.rhcloud.com> > > > > 2016-06-01 21:50 GMT+02:00 Shultz, Dmitry <[hidden > > email]</user/SendEmail.jtp?type=node&node=5783367&i=0>>: > > > > > Added following dependencies to the pom file (not sure if it's the > > > right way to go though): > > > > > > <dependency> > > > <groupId>javax.faces</groupId> > > > <artifactId>javax.faces-api</artifactId> > > > <version>2.2</version> > > > <scope>test</scope> > > > </dependency> > > > > > > And it fixed the original exception, but now I'm getting this: > > > > > > java.lang.RuntimeException: Error instantiating class > > > org.apache.bval.cdi.BValExtension > > > > > > at > > > > org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:245) > > > at > > > org.jboss.weld.util.ServiceLoader.loadService(ServiceLoader.java:214) > > > at > > > > org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:182) > > > at > > org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:162) > > > at > > > org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:297) > > > at > com.google.common.collect.Iterables.addAll(Iterables.java:352) > > > at > > org.jboss.weld.environment.se.Weld.getExtensions(Weld.java:718) > > > at > > > org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:632) > > > at org.jboss.weld.environment.se.Weld.initialize(Weld.java:543) > > > at > > > > > org.apache.camel.test.cdi.CamelCdiDeployment$1.evaluate(CamelCdiDeploy > > ment.java:68) > > > at org.junit.rules.RunRules.evaluate(RunRules.java:20) > > > at org.junit.runners.ParentRunner.run(ParentRunner.java:309) > > > at org.junit.runner.JUnitCore.run(JUnitCore.java:160) > > > at > > > > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4Ide > > aTestRunner.java:119) > > > at > > > > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4Ide > > aTestRunner.java:42) > > > at > > > > > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JU > > nitStarter.java:234) > > > at > > > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > > at > > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j > > ava:62) > > > at > > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess > > orImpl.java:43) > > > at java.lang.reflect.Method.invoke(Method.java:497) > > > at > > > com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) > > > Caused by: java.lang.NoSuchMethodError: > > > > > javax.validation.Configuration.getBootstrapConfiguration()Ljavax/valid > > ation/BootstrapConfiguration; > > > at > > org.apache.bval.cdi.BValExtension.<init>(BValExtension.java:94) > > > at > > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > > > Method) > > > at > > > > > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructo > > rAccessorImpl.java:62) > > > at > > > > > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCo > > nstructorAccessorImpl.java:45) > > > at > > java.lang.reflect.Constructor.newInstance(Constructor.java:422) > > > at > > > > org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:240) > > > ... 21 more > > > > > > Any idea how to resolve this one? Am I doing something totally wrong > > here? > > > > > > Dmitry > > > > > > > > > -----Original Message----- > > > From: dimas [mailto:[hidden > > email]</user/SendEmail.jtp?type=node&node=5783367&i=1>] > > > Sent: June-01-16 12:27 PM > > > To: [hidden email]</user/SendEmail.jtp?type=node&node=5783367&i=2> > > > Subject: camel-test-cdi + OpenEJB fails on weld dependency? > > > > > > Hi All, > > > > > > Here is my app environment: Camel-CDI 2.17.1, TomEE/openejb-core 7.0.0. > > > > > > I'm trying to test the app using camel-test-cdi and getting this > > exception: > > > java.lang.RuntimeException: Error instantiating class > > > org.apache.deltaspike.jsf.impl.scope.mapped.MappedJsf2ScopeExtension > > > > > > at > > > > org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:245) > > > at > > > org.jboss.weld.util.ServiceLoader.loadService(ServiceLoader.java:214) > > > at > > > > org.jboss.weld.util.ServiceLoader.loadServiceFile(ServiceLoader.java:182) > > > at > > org.jboss.weld.util.ServiceLoader.reload(ServiceLoader.java:162) > > > at > > > org.jboss.weld.util.ServiceLoader.iterator(ServiceLoader.java:297) > > > at > com.google.common.collect.Iterables.addAll(Iterables.java:352) > > > at > > org.jboss.weld.environment.se.Weld.getExtensions(Weld.java:718) > > > at > > > org.jboss.weld.environment.se.Weld.createDeployment(Weld.java:632) > > > at org.jboss.weld.environment.se.Weld.initialize(Weld.java:543) > > > at > > > > > > > > org.apache.camel.test.cdi.CamelCdiDeployment$1.evaluate(CamelCdiDeploy > > ment.java:68) > > > at org.junit.rules.RunRules.evaluate(RunRules.java:20) > > > at org.junit.runners.ParentRunner.run(ParentRunner.java:309) > > > at org.junit.runner.JUnitCore.run(JUnitCore.java:160) > > > at > > > > > > > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4Ide > > aTestRunner.java:119) > > > at > > > > > > > > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4Ide > > aTestRunner.java:42) > > > at > > > > > > > > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JU > > nitStarter.java:234) > > > at > > > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74) > > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > > at > > > > > > > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j > > ava:62) > > > at > > > > > > > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccess > > orImpl.java:43) > > > at java.lang.reflect.Method.invoke(Method.java:497) > > > at > > > com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) > > > Caused by: java.lang.NoClassDefFoundError: > > > javax/faces/bean/ApplicationScoped > > > at > > > > > > > > org.apache.deltaspike.jsf.impl.scope.mapped.MappedJsf2ScopeExtension.< > > init>(MappedJsf2ScopeExtension.java:56) > > > at > > > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native > > > Method) > > > at > > > > > > > > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructo > > rAccessorImpl.java:62) > > > at > > > > > > > > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingCo > > nstructorAccessorImpl.java:45) > > > at > > java.lang.reflect.Constructor.newInstance(Constructor.java:422) > > > at > > > > org.jboss.weld.util.ServiceLoader.prepareInstance(ServiceLoader.java:240) > > > ... 21 more > > > Caused by: java.lang.ClassNotFoundException: > > > javax.faces.bean.ApplicationScoped > > > at java.net.URLClassLoader.findClass(URLClassLoader.java:381) > > > at java.lang.ClassLoader.loadClass(ClassLoader.java:424) > > > at > sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) > > > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > > > ... 27 more > > > > > > I'm not sure why weld classes are loaded, why my test depends from > > > javax.faces.bean.ApplicationScoped (so far there is no UI of any > > > kind) > > and > > > what to do in order to resolve the error. > > > > > > Cheers, > > > Dmitry > > > > > > > > > > > > -- > > > View this message in context: > > > > > http://camel.465427.n5.nabble.com/camel-test-cdi-OpenEJB-fails-on-weld > > -dependency-tp5783365.html > > > Sent from the Camel - Users mailing list archive at Nabble.com. > > > > > > > ________________________________ > > If you reply to this email, your message will be added to the > > discussion > > below: > > > > http://camel.465427.n5.nabble.com/camel-test-cdi-OpenEJB-fails-on-weld > > -dependency-tp5783365p5783367.html > > To unsubscribe from camel-test-cdi + OpenEJB fails on weld > > dependency?, click here< > > http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsub > > scribe_by_code&node=5783365&code=RG1pdHJ5X1NodWx0ekBrYWx0aXJlLmNvbXw1N > > zgzMzY1fC0xNzc2OTA3NTYz > > >. > > NAML< > > http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro > > _viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespa > > ces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.vie > > w.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3 > > Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21 > > nabble%3Aemail.naml > > > > > > > > > > > > > -- > > View this message in context: > > http://camel.465427.n5.nabble.com/camel-test-cdi-OpenEJB-fails-on-weld > > -dependency-tp5783365p5783371.html > > Sent from the Camel - Users mailing list archive at Nabble.com. > > >