Hello, Thanks everyone for your help. The issue comes from my factory class holding a @Produces method where I forget to use a qualifier used for the bean I want to be injected.
But I learn that if we use some Exception mappers, it's quite difficult to get the root cause. Best Regards. -----Original Message----- From: Romain Manni-Bucau [mailto:[email protected]] Sent: vendredi 5 mai 2017 17:45 To: [email protected] Subject: Re: Issue with CDI injection: got CreationException with StackOverflowError Or just scoping beans a ans b. Lazy init of cdi would work. That said it can be a missing dep or a conflicting api too. Put a breakpoint in the exception constructor and print the stack, you ll know very quickly ;). Le 5 mai 2017 17:38, "Laird Nelson" <[email protected]> a écrit : > On Fri, May 5, 2017 at 7:57 AM COURTAULT Francois < > [email protected]> wrote: > > > I perform the same test by using curl instead of Swagger UI and I > > got the same response: > > {"code":500,"messages":["javax.enterprise.inject. > CreationException","java.lang.StackOverflowError"," > > - Caused by: null"]}. > > > > I can't speak to TomEE here but this means almost certainly that you > have something like: > > public class A { > @Inject > private B b; > } > public class B { > @Inject > private A a; > } > > You can resolve these situations with: > > public class A { > @Inject > private *Provider<B> bProvider*; > } > public class B { > @Inject > private A a; > } > > …or: > > public class A { > @Inject > private B b; > } > public class B { > @Inject > private *Provider<A> aProvider*; > } > > Best, > Laird > -- > http://about.me/lairdnelson > ________________________________ This message and any attachments are intended solely for the addressees and may contain confidential information. Any unauthorized use or disclosure, either whole or partial, is prohibited. E-mails are susceptible to alteration. Our company shall not be liable for the message if altered, changed or falsified. If you are not the intended recipient of this message, please delete it and notify the sender. Although all reasonable efforts have been made to keep this transmission free from viruses, the sender will not be liable for damages caused by a transmitted virus.
