Regression: Unable to deploy self referencing EJB3 session b
rradu Oct 20, 2008 3:01 AMHello,
I have the following test case that deploys fine in Jboss 4.2.3 but fails to deploy in Jboss 5.0.0-CR2 (all run with JDK 1.6.0_06) on Fedora Core 9.
package test; import javax.ejb.*; @EJBs({@EJB(name="TestSessionBean/local",beanInterface=LocalTestSession.class,beanName="TestSessionBean")}) @Stateless(name="TestSessionBean") public class TestSessionBean implements LocalTestSession { public String test() { try { InitialContext ic = new InitialContext(); LocalTestSession lc = (LocalTestSession) ic.lookup("java:comp/env/TestSessionBean/local"); System.out.println(lc.test1()); } catch (NamingException e) { e.printStackTrace(); } return "test"; } public String test1() { return "test1"; } }
package test; import javax.ejb.Local; @Local public interface LocalTestSession { public String test(); public String test1(); }
The problems seems to be related to the binding of the local interface to the java:comp/env domain. The same problem occurs if I have 2 session beans A and B and the @EJBs annotation in bean A reference bean B and vice-versa. If I just inject the bean reference instead of binding it to the jndi java:comp/env it works fine.
Here is the log from the test case above in jboss 5.0 CR2:
09:57:18,489 WARN [EjbMetadataJndiPolicyDecoratorDeployer] Defaulting to DefaultJndiBindingPolicy of "org.jboss.metadata.ejb.jboss.jndipolicy.plugins.BasicJndiBindingPolicy" for Session Bean TestSessionBean 09:57:19,173 INFO [JBossASKernel] Created KernelDeployment for: test.jar 09:57:19,179 INFO [JBossASKernel] installing bean: jboss.j2ee:ear=test.jar,jar=test.jar,name=TestSessionBean,service=EJB3 09:57:19,179 INFO [JBossASKernel] with dependencies: 09:57:19,179 INFO [JBossASKernel] and demands: 09:57:19,179 INFO [JBossASKernel] jndi:TestSessionBean/local-test.LocalTestSession 09:57:19,179 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService 09:57:19,179 INFO [JBossASKernel] and supplies: 09:57:19,179 INFO [JBossASKernel] jndi:TestSessionBean/local-test.LocalTestSession 09:57:19,179 INFO [JBossASKernel] jndi:TestSessionBean/remote 09:57:19,179 INFO [JBossASKernel] jndi:TestSessionBean/local 09:57:19,179 INFO [JBossASKernel] Class:test.LocalTestSession 09:57:19,179 INFO [JBossASKernel] Added bean(jboss.j2ee:ear=test.jar,jar=test.jar,name=TestSessionBean,service=EJB3) to KernelDeployment of: test.jar 09:57:19,227 WARN [HDScanner] Failed to process changes org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State} jboss.j2ee:ear=test.jar,jar=test.jar,name=TestSessionBean,service=EJB3 -> <UNKNOWN jboss.j2ee:ear=test.jar,jar=test.jar,name=TestSessionBean,service=EJB3>{Described:** UNRESOLVED Demands 'jndi:TestSessionBean/local-test.LocalTestSession' **} *** CONTEXTS IN ERROR: Name -> Error <UNKNOWN jboss.j2ee:ear=test.jar,jar=test.jar,name=TestSessionBean,service=EJB3> -> ** UNRESOLVED Demands 'jndi:TestSessionBean/local-test.LocalTestSession' ** at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:709) at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:661) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:291) at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619)
Best Regards,
Radu