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(CamelCdiDeployment.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(JUnit4IdeaTestRunner.java:119)
>         at
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
>         at
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.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.java:62)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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/validation/BootstrapConfiguration;
>         at org.apache.bval.cdi.BValExtension.<init>(BValExtension.java:94)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.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(CamelCdiDeployment.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(JUnit4IdeaTestRunner.java:119)
>         at
>
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:42)
>         at
>
> com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.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.java:62)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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(NativeConstructorAccessorImpl.java:62)
>         at
>
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.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=unsubscribe_by_code&node=5783365&code=RG1pdHJ5X1NodWx0ekBrYWx0aXJlLmNvbXw1NzgzMzY1fC0xNzc2OTA3NTYz>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%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.

Reply via email to