我的耳朵里有两个jar。第一个包含两个具有相同本地接口的无状态ejb。他们每个人都有一个 name
arg输入 @Stateless
注解( "OneEjb"
以及 "TwoEjb"
).
我尝试用代码从第二个ejbjar在ejb中绑定其中一个
@EJB(name = "OneEjb")
private CommonMyEjbInterface myEjb
但部署失败并出现错误
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYEJB0408: More than one EJB found with interface of type 'CommonMyEjbInterface' for binding OneEjb. Found: [View of type CommonMyEjbInterface for org.jboss.as.ejb3.component.stateless.StatelessComponentDescription{serviceName=service jboss.deployment.subunit."my-ear-20.2.5-SNAPSHOT.ear"."first-my-ejb-jar.jar".component.OneEjb}@287478a1, View of type CommonMyEjbInterface for org.jboss.as.ejb3.component.stateless.StatelessComponentDescription{serviceName=service jboss.deployment.subunit."my-ear-20.2.5-SNAPSHOT.ear"."first-my-ejb-jar.jar".component.TwoEjb}@4eeab6a9]
如果我用这个就可以了
@EJB(lookup = "java:app/first-my-ejb-jar/OneEjb")
如何在不使用ejbjar文件名(不带扩展名)的情况下绑定ejb?
环境:java-21 java-11
暂无答案!
目前还没有任何答案,快来回答吧!