我寫了一個示例EJB類,如下圖所示:EJB類
@Stateless(mappedName = "BusinessSLSB")
@Local(BusinessLocal.class)
@TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW)
public class BusinessSLSB implements BusinessLocal{
//body of the class
}
我在同一項目中的非EJB類的,我嘗試查找文件中的下列方式:
public class GetTransactionData {
private BusinessLocal business;
public GetTransactionDataForMercury(){
notifier.info("Creating an object of GetTransactionData");
try{
InitialContext ctx = new InitialContext();
business = (BusinessLocal) ctx.lookup("BusinessSLSB");
}catch(Exception ne){
notifier.error("Error occurred --> " + ne.getMessage());
}
}
當我執行的代碼,我得到以下異常:
Error occurred --> Unable to resolve BusinessSLSB. Resolved '
難道我走錯了在提供查找名稱?我該如何解決這個問題?
我使用WebLogic Server 10.3.3。它支持EJB 3.0。如何識別服務器分配的JNDI名稱?日誌文件不包含任何此類信息 – San