EJB3 bound problem in JBoss AS 6
kirillica May 27, 2011 7:58 AMHello guys,
I'm about to migrate from JBoss 5.1 to JBoss 6.0 (need to move to JSF2, RichFaces 4 and etc) and here is a list of problems I have with EJB3:
1) during startup EJB were unable to bound (if EJB is in separate jar). This was fixed adding mappedName in annotation (and bug ticket says this will be fixed in version 7).
OK, with additional parameter this seems to be working:
11:55:51,038 INFO [org.jboss.ejb3.deployers.JBossASKernel] installing bean: jboss.j2ee:ear=MyApplication.ear,jar=MyBusiness.jar,name=SomeBeanDAOImpl,service=EJB3
11:55:51,038 INFO [org.jboss.ejb3.deployers.JBossASKernel] with dependencies:
11:55:51,038 INFO [org.jboss.ejb3.deployers.JBossASKernel] and demands:
11:55:51,038 INFO [org.jboss.ejb3.deployers.JBossASKernel] jboss.ejb:service=EJBTimerService; Required: Described
11:55:51,038 INFO [org.jboss.ejb3.deployers.JBossASKernel] persistence.unit:unitName=MyApplication.ear/MyBusiness.jar#My; Required: Described
11:55:51,039 INFO [org.jboss.ejb3.deployers.JBossASKernel] jboss-switchboard:appName=MyApplication,module=MyBusiness,name=SomeBeanDAOImpl; Required: Create
11:55:51,039 INFO [org.jboss.ejb3.deployers.JBossASKernel] jboss-injector:topLevelUnit=MyApplication.ear,unit=MyBusiness.jar,bean=SomeBeanDAOImpl; Required: Described
11:55:51,040 INFO [org.jboss.ejb3.deployers.JBossASKernel] and supplies:
11:55:51,040 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:SomeBeanDAOImpl
11:55:51,040 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:MyApplication/SomeBeanDAOImpl/local-ee.helmes.My.business.dao.SomeBeanDAO
11:55:51,040 INFO [org.jboss.ejb3.deployers.JBossASKernel] Class:ee.helmes.My.business.dao.SomeBeanDAO
11:55:51,040 INFO [org.jboss.ejb3.deployers.JBossASKernel] jndi:MyApplication/SomeBeanDAOImpl/local
11:55:51,041 INFO [org.jboss.ejb3.deployers.JBossASKernel] Added bean(jboss.j2ee:ear=MyApplication.ear,jar=MyBusiness.jar,name=SomeBeanDAOImpl,service=EJB3) to KernelDeployment of: MyBusiness.jar
2) But still cannot be injected into beans:
@EJB( mappedName="SomeBeanDAOImpl/local", beanInterface=SomeBeanDAO.class)
protected SomeBeanDAO dao;
(I've tried context.lookup with different variants and no help)
It says:
Caused by: org.jboss.injection.manager.spi.InjectionException: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: SomeBeanDAOImpl not bound]
at org.jboss.injection.injector.EEInjector.inject(EEInjector.java:87)
at org.jboss.injection.manager.core.DefaultInjectionContext.proceed(DefaultInjectionContext.java:58)
at org.jboss.injection.manager.core.DefaultInjectionManager.inject(DefaultInjectionManager.java:58)
at org.jboss.injection.manager.core.DefaultInjectionManager.inject(DefaultInjectionManager.java:64)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.processInjectors(TomcatInjectionContainer.java:410)
at org.jboss.web.jsf.integration.injection.JBossDelegatingInjectionProvider.inject(JBossDelegatingInjectionProvider.java:77)
... 46 more
Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: SomeBeanDAOImpl not bound]
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1356)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:819)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:835)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jboss.injection.injector.EEInjector.lookup(EEInjector.java:153)
at org.jboss.injection.injector.EEInjector.inject(EEInjector.java:133)
at org.jboss.injection.injector.EEInjector.inject(EEInjector.java:82)
... 51 more
Caused by: javax.naming.NameNotFoundException: SomeBeanDAOImpl not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1350)
... 58 more
So what is wrong with JBoss 6.0 comparing to JBoss 5.1 where things were working this way?
P.S.
Interface for EJB:
@Local
public interface SomeBeanDAO extends DataTableDAO
Bean:
@SecurityDomain(<...>)
@Stateless
public class SomeBeanDAOImpl extends DAOImplBase implements SomeBeanDAO