我的外部記憶區

2007年10月4日星期四

Retrive EJB from JBoss AS on Servlet

Notes for generic web programming.

To retrieve EJB from JNDI provided by JBoss AS (version 4.x):


try {
Context c = new InitialContext();
myEjb = (EJBInterface) c.lookup(EJB_JNDI_NAME);
} catch (NamingException e) {
throw new ServletException("Error while connecting to server", e);
}

沒有留言: