为什么无法为EJB找到Webligic的JNDI名称?

时间:2014-01-27 14:53:45

标签: maven ejb weblogic javabeans jndi

我有一个 EAR 文件,该结构显示了 EJB

project-ear
        |-----project-business.jar
                        |-----SupervisorProcesserBean(class) (@Stateless)
                        |-----SupervisorProcesserBeanLocal(interface) (@Local)
        |-----project-dao.jar
                        |-----SupervisorDAOImpl(class) (@Stateless)
                        |-----SupervisorDAOLocal(interface) (@Local)

这是我的 SupervisorDAOImpl bean:

@Stateless
public class SupervisorDAOImpl implements SupervisorDAOLocal {
    @Override
    public void doSomething() {
        //do something
    }
}

使用 SupervisorDAOLocal 界面:

@Local
public interface SupervisorDAOLocal {
    public void doSomething();
}

我的 SupervisorProcesserBean bean:

@Stateless
public class SupervisorProcesserBean implements SupervisorProcesserBeanLocal {
    @EJB
    private SupervisorDAOLocal supervisorDao;
    ....
}

使用 SupervisorProcesserBeanLocal 界面:

@Local
public interface SupervisorProcesserBeanLocal {
    ....
}

您可以看到,我想将 SupervisorDAOLocal 注入 SupervisorProcesserBean 。 当我想将其部署到 weblogic 时,我收到此错误:

Error resolving ejb-ref "com.viktor.business.SupervisorProcesserBean/supervisorDAO" 
from module "project-war-1.0.0-SNAPSHOT.war" of application "project-ear-1.0.0-SNAPSHOT". 
The ejb-ref does not have an ejb-link and the JNDI name of the target Bean has not been specified.

怎么可能?这两个bean都有一个Local接口。

1 个答案:

答案 0 :(得分:0)

JNDI名称是使用您似乎没有的远程接口名称构建的。将@Local注释更改为@Remote,然后重试。