Open maxusoltsev opened 8 years ago
Could you post your solution?
Please take a look on https://github.com/maxusoltsev/vaadin-jetty-cdi
Thank you a lot.
In case s.o. is interested, I've used s.t. like this:
public class MyExtension implements Extension { void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) { try { InitialContext ic = new InitialContext(); ic.bind("java:comp/BeanManager", bm); } catch (NamingException e1) { } try { InitialContext ic = new InitialContext(); ic.bind("java:comp/env/BeanManager", bm); } catch (NamingException e1) { } } }
and a file META-INF/services/javax.enterprise.inject.spi.Extension advertising the extension...
Hello ! When using jetty-maven-plugin 9.3.9.v20160517 and vaadin-cdi 1.0.3, UIs annnotated as @CDIUI does not work, i think becouse jetty does not expose BeasManager as "java:comp/BeanManager", "java:comp/env/BeanManager" jndi names, so com.vaadin.cdi.internal.CDIUtil#lookupBeanManager returns null (but @Inject works). It can be resolved by using CDI.current().getBeanManager() (and it works) instead of lookup, but javax.enterprise.inject.spi.CDI is availible only in javaee 7 api (CDI 1.1), and vaadin-cdi uses javaee-api 6. I resolved this issue locally by overriding com.vaadin.cdi.CDIUIProvider , VaadinCDIServlet, etc, but maybe there is some simpler way ? Thank you.