简体   繁体   English

EJB查找失败

[英]EJB lookup failed

Am trying to lookup an EJB and when am doing so, getting error as 我试图查找EJB,当我这样做时,得到错误
While trying to look up comp/env/ejb/UserImpl in /app/webapp/BSWeb/131433158

RestImpl: ` RestImpl:`

@Produces("application/json")
@Consumes("application/json")
@Path("UserSession")
@Stateless 
public class UserSessionManagerImpl {
@Context
HttpServletRequest httpServletRequest;
@Context
HttpServletResponse httpServletResponse;
@POST
@Path("retrieveUserProfile")
public RetrieveUserProfile retrieveUserProfile (RetrieveUserProfileRequest request)
{
try {
InitialContext ctx = new InitialContext();
IUserSessionManagerIntf manager = (IUserSessionManagerIntf) ctx.lookup("java:comp/env/ejb/UserSessionImpl");
replyVO.retrieveUserProfile();
} catch (Exception namingException) {
namingException.printStackTrace();
}

My EJB 我的EJB

@Stateless(name = "UserSessionImpl", mappedName = "ejb/UserSessionImpl")
@Local
public class UserSessionImpl implements IUserSessionManagerIntf {
retrieveUserProfile(){
....
}

Can some one help on this. 有人可以帮忙解决这个问题。 Am using this in a rest implementation. 我在休息实现中使用它。 On ejb lookup it fails 在ejb查找它失败

Have you tried to put: 你试过放:

@EJB(name="ejb/UserSessionImpl", beanInterface = IUserSessionManagerIntf.class)

on your UserSessionManagerImpl class? 在您的UserSessionManagerImpl类? mappedName property is vendor specific. mappedName属性是特定于供应商的。 You should not assume that you'll find your bean with mapped name under java:comp/env . 您不应该假设您将在java:comp/env下找到带有映射名称的bean。 Instead you can use my above suggestion or global JNDI names (or vendor-specific functionality - check in docs). 相反,您可以使用我的上述建议或全局JNDI名称(或特定于供应商的功能 - 签入文档)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM