Using JPAContainer with EntityManager by @PersistenceContext

Hi all,

I’m a bit confused.
I’m @Inject-ing a custom component into a @CDIView.
The component has its PersistenceContext injected

@PersistenceContext
private EntityManager em;

During @PostConstruct I assign a JPAContainer to a ListSelect, creating the container with JPAContainerFactory.make(MyEntity.class, em).

So far everything fine. If I look at it in debug, the EntityManager exists, I can even query the JPAContainer and get a result but when the View loads in my Application I get a javax.naming.NameNotFoundException: env/persistence/em

So I wonder: Why?
Why is there a lookup when I passed a EntityManager in the first place?
Is there some bit of configuration I missed? Is passing a Injected EntityManager in the JPAContainerFactory discouraged?

10:38:44,764 FATAL [com.vaadin.server.DefaultErrorHandler]
 (http--0.0.0.0-8180-2) : java.lang.RuntimeException: javax.naming.NameNotFoundException: env/persistence/em -- service jboss.naming.context.java.module.OAuthAdminConsole.OAuthAdminConsole.env.persistence.em
    at com.vaadin.addon.jpacontainer.provider.jndijta.Util.getEntityManager(Util.java:35) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.addon.jpacontainer.provider.jndijta.CachingMutableEntityProvider.getEntityManager(CachingMutableEntityProvider.java:59) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.addon.jpacontainer.provider.LocalEntityProvider.doGetEntityManager(LocalEntityProvider.java:226) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.addon.jpacontainer.provider.LocalEntityProvider.createFilteredQuery(LocalEntityProvider.java:379) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.addon.jpacontainer.provider.CachingSupport.getIds(CachingSupport.java:477) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.addon.jpacontainer.provider.CachingSupport$FilterCacheEntry.getAllIds(CachingSupport.java:408) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.addon.jpacontainer.provider.CachingSupport.getAllEntityIdentifiers(CachingSupport.java:750) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.addon.jpacontainer.provider.CachingMutableLocalEntityProvider.getAllEntityIdentifiers(CachingMutableLocalEntityProvider.java:106) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.addon.jpacontainer.JPAContainer.getItemIds(JPAContainer.java:881) [jpacontainer-3.1.1.jar:3.1.1]

    at com.vaadin.ui.AbstractSelect.getItemIds(AbstractSelect.java:728) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.ui.AbstractSelect.paintContent(AbstractSelect.java:367) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.ui.OptionGroup.paintContent(OptionGroup.java:66) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:81) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:110) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.server.communication.UidlRequestHandler.writeUidl(UidlRequestHandler.java:151) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:99) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1405) [vaadin-server-7.2.3.jar:7.2.3]

    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:237) [vaadin-server-7.2.3.jar:7.2.3]

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

    at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_39]