How do I lookup from a web application an EJB deployed standalone ?

Supposing you have deployed an Enterprise Java Bean as stand alone application and you want to access it from your Servlet / Jsp layer. What you need to do is adding the appropriate references to your web.xml and jboss-web.xml.

So if you have an EJB named "HelloBean" add to your web.xml


Then modify jboss-web.xml by adding:


Now you can safely lookup your EJB from your Servlet:

Context ic = new InitialContext();
Object ejbHome = ic.lookup("java:comp/env/HelloBean");

Related articles available on

EJB 3.0 tutorial : Session Beans

Enterprise JavaBeans (EJB) technology is a J2EE technology for de

JBoss MDB 3.0

Message-driven beans (MDBs) are stateless, server-side, transacti


In a Bean Managed Transaction, the code in the session or message

How do you keep your EJB callbacks separated from biz. methods?

JBoss daily recipe

How to set EJB timeout period ?

JBoss recipe of the day

How to add a Selector with MDB 3.0 ?

Message selectors allow an MDB to be more selective about the mes

Follow us on Twitter