问题
I'm trying to deploy the application in Weblogic 12c. During deployment, I'm getting the below error
weblogic.management.DeploymentException: weblogic.application.naming.ReferenceResolutionException: [J2EE:160092]Error: The ejb-link "BeanClass" declared in the ejb-ref or ejb-local-ref "...BeanClassService/beanClass" in the module "....EJB.jar" is ambiguous. Qualify this ejb-link to remove the ambiguity.
Code:
IBeanClass.java
@Local
public interface IBeanClass {}
BeanClass.java
@Stateless(name = "BeanClass")
@PermitAll
public class BeanClass implements IBeanClass { ...... }
IBeanClassService.java
@Local
public interface IBeanClassService { ......... }
BeanClassService.java
@Stateless(name = "BeanClassService")
public class BeanClassService implements IBeanClassService {
@EJB(beanName = "BeanClass")
private IBeanClassService beanclass;
... }
I'm making a call to the EJB from the web application project:
ClientClass.java
public class ClientClass{ ....
@EJB(beanName = "BeanClassService")
private IBeanClassService beanclass;
..... }
The code was working fine in weblogic10 but now in weblogic 12 exception occurs. Please help in resolving this issue.
回答1:
BeanClass
is not an IBeanClassService
, so even by basic java convention, you cannot assign a IBeanClass
object to that variable there, let alone inject an EJB into that spot. What you should have is
@EJB(beanName = "BeanClass")
private IBeanClass beanclass;
回答2:
i have the same problem the solution was:
<dependency>
<groupId>bo.sigep.modulo</groupId>
<artifactId>moduloSigep-ejb</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
in the war pom maven the key is provided regards
来源:https://stackoverflow.com/questions/25282983/weblogic12c-deployment-ejb-ambiguous-error