我编写了一个示例 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 '
我在提供查找名称时出错了吗?我该如何解决这个问题?