EJB3 and persistence in JBOSS 6.0.0
franckl Sep 1, 2010 8:51 AMHi,
will I was testing Jboss 6, I found out that a Session Bean I created cannot be accessed anymore when I add the persistentContext attribute in the code:
@PersistenceContext(unitName = "bookshopUnit")
protected EntityManager em;
When I add this, the bean is not referenced in JNDI, and cannot be accessed.
In the log I can see
14:30:22,062 INFO [org.jboss.ejb3.deployers.JBossASKernel] Created KernelDeployment for: bookshopEjb.jar
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] installing bean: jboss.j2ee:ear=testEAR.ear,jar=bookshopEjb.jar,name=BookShop,service=EJB3
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] with dependencies:
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] and demands:
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] and supplies:
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:testEAR/BookShop/remote
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:testEAR/BookShop/local
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:BookShop
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:testEAR/BookShop/remote-com.sqli.bookshop.facade.BookShopFacadeRemote
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] Class:com.bookshop.facade.BookShopFacadeRemote
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:testEAR/BookShop/local-com.bookshop.facade.BookShopFacadeLocal
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] Class:com.bookshop.facade.BookShopFacadeLocal
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] Added bean(jboss.j2ee:ear=testEAR.ear,jar=bookshopEjb.jar,name=BookShop,service=EJB3) to KernelDeployment of: bookshopEjb.jar
14:30:22,078 INFO [org.jboss.ejb3.deployers.JBossASKernel] installing bean: jboss.j2ee:ear=testEAR.ear,jar=bookshopEjb.jar,name=ShoppingCart,service=EJB3
---> Bean cannot be accessed with JNDI anymore
When I try to access this bean through JNDI, I get BookShop not bound.
When I remove the persistentContext from the code, my Java client can access the bean with JNDI.
Do I miss something ?
Thanks
Franck