我有一个关于OpenEJB和集成测试的奇怪问题。 我正在使用Open EJB 4.5.1,JUnit 4.10和Maven3与surefire插件2.13 我从测试中开始OpenEJB:
InitialContext ic = new InitialContext();
它(显然)工作正常并正确部署EJB( CentrosBeanFacade ),但之后它再次尝试绑定它,这会导致服务器失败。
这些是有趣的日志部分:
第一次 - > [确定]:
DEBUG - bound ejb at name: openejb/Deployment/CentrosBeanFacade/com.csc.health.xhis.arqtest.api.CentrosLogica, ref: org.apache.openejb.core.ivm.naming.BusinessRemoteReference@6506fe2b
DEBUG - bound ejb at name: openejb/Deployment/CentrosBeanFacade/com.csc.health.xhis.arqtest.api.CentrosLogica!Remote, ref: org.apache.openejb.core.ivm.naming.BusinessRemoteReference@6506fe2b
INFO - Jndi(name=CentrosBeanFacade) --> Ejb(deployment-id=CentrosBeanFacade)
INFO - Jndi(name=global/classpath.ear/test-ejb/CentrosBeanFacade!com.csc.health.xhis.arqtest.api.CentrosLogica) --> Ejb(deployment-id=CentrosBeanFacade)
INFO - Jndi(name=global/classpath.ear/test-ejb/CentrosBeanFacade) --> Ejb(deployment-id=CentrosBeanFacade)
但是它试图再次部署它。
DEBUG - failed to bind ejb at name: openejb/Deployment/CentrosBeanFacade/com.csc.health.xhis.arqtest.api.CentrosLogica, ref: org.apache.openejb.core.ivm.naming.BusinessRemoteReference@32f00d9a
ERROR - Jndi name could not be bound; it may be taken by another ejb. Jndi(name=openejb/Deployment/CentrosBeanFacade/com.csc.health.xhis.arqtest.api.CentrosLogica!Remote)
来自EJB的内部BusinessRemoteReference是与第一次不同的对象,因此 尝试再次部署它。但我检查了类路径,并且EJB没有包括两次。如果我从普通的Java类执行类似的过程,它也会失败。
任何线索?