oh, ear :). Here is what tomee does for ears: it aligns CDI on the classloading hierarchy (the least worse solution IMO),
ear/lib = one CDI context webapp = one CDI context inherit most of the ear/lib Beans if the producer is in the webapp it can't work if the consumer (@Inject) is not. Seems you respected this logic if I got your first mail right so i would recommand you to debug in org.apache.openejb.cdi.WebappBeanManager#mergeBeans and check if you producer is added (org.apache.openejb.cdi.WebappBeanManager.InheritedBeanFilter#accept if the filter logic) Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <https://blog-rmannibucau.rhcloud.com> | Old Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2017-02-08 14:40 GMT+01:00 Hynek <[email protected]>: > Romain Manni-Bucau wrote > > if it helps here is a test with your code which works (tested with > > 7.0.3-SNAPSHOT): > > https://gist.github.com/rmannibucau/4acf9033372aceb2ae97a6986f40c4b7 > > Thanks for the unit test. I can confirm it works OK in my environment, too. > Is there anything else I can check to figure out why the same code doesn't > produce the expected result in the real environment? Could it be the > packaging structure that is causing trouble (jar, war in an ear)? > > > > -- > View this message in context: http://tomee-openejb.979440. > n4.nabble.com/EntityManager-EntityManagerFactory-not-injected-to-CDI-bean- > tp4681031p4681043.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
