确实@EJB注释工作,为远程调用? [英] does @EJB Annotation work for remote call?
本文介绍了确实@EJB注释工作,为远程调用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public class Servlet2Stateless extends HttpServlet {
@EJB private HelloUserLocal helloUser;
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
out.println(newSess.getName());
}
将上述code的老本行,当我已经EJB和Servlet部署在不同的服务器上?或者我需要通过传统的方式来调用它????
will above line of code work when I have EJB and Servlet deployed on different servers? or I need to call it through traditional way????
推荐答案
如果该EJB驻留在不同的服务器比客户端(Servlet的)比你不能@EJB标注使用依赖注入。
If the EJB resides on the different server than your client (Servlet) than you cannot use the dependency injection with @EJB annotation.
我想,你需要去与旧的JNDI的方式。
I guess that you'll need to go with the old JNDI way.
这篇关于确实@EJB注释工作,为远程调用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文