Weblogic12c deployment EJB ambiguous error

2019-08-07 02:18发布

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.

2条回答
Anthone
2楼-- · 2019-08-07 02:55

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

查看更多
时光不老,我们不散
3楼-- · 2019-08-07 02:56

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;
查看更多
登录 后发表回答