2014-01-27 70 views
0

我有一個EAR文件,結構顯示EJB裏面裝:爲什麼無法找到Webligic的EJB的JNDI名稱?

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

這裏是我的SupervisorDAOImpl豆:

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

與它的SupervisorDAOLocal接口:

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

而且我SupervisorProcesserBean豆:

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

與它的SupervisorProcesserBeanLocal接口:

@Local 
public interface SupervisorProcesserBeanLocal { 
    .... 
} 

你可以看到,我想注入SupervisorDAOLocalSupervisorProcesserBean。 當我想將它部署到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都有一個本地接口。

+0

你的戰爭中的web.xml(在WEB-INF下)是什麼樣的?聽起來像它缺少ejb信息。參考:http://docs.oracle.com/cd/E15051_01/wls/docs103/webapp/configureresources.html –

回答

0

JNDI名稱是使用您似乎沒有的名稱的遠程接口名稱構建的。將@Local註釋更改爲@Remote並重試。