Burlap EJB Client
Resin 3.0

Features
Installation
Configuration
Web Applications
IOC/AOP
Resources
JSP
Servlets and Filters
Portlets
Databases
Admin (JMX)
CMP
EJB
Amber
EJB 3.0
Security
XML and XSLT
XTP
JMS
Performance
Protocols
Third-party
Troubleshooting/FAQ

Tutorials
Burlap Clients
Hessian Clients
CORBA/IIOP Server
Scrapbook
Tutorials
EJB
Hessian Clients

Configuring an EJB client using the Burlap protocol uses the BurlapContextFactory as a JNDI link. The client will use JNDI to lookup the EJB home interfaces.

Burlap EJB Client

Resin-EJB with Burlap
<web-app>
  <jndi-link>
    <jndi-name>java:comp/env/ejb</jndi-name>
    <jndi-factory>com.caucho.burlap.BurlapContextFactory</jndi-factory>
    <init-param java.naming.provider.url="http://host.com/burlap"/>
  </jndi-link>
</web-app>

Sample client code follows. The EJBHome lookup is in the init() method for efficiency.

Client Servlet
import javax.servlet.*;
import javax.namingdservlet.*;

public class ClientServlet extends GenericServlet {
  TestHome home;

  public void init()
    throws ServletException
  {
    try {
      Context env = (Context) new InitialContext().lookup("java:comp/env");

      home = (TestHome) env.lookup("ejb/test");
    } catch (Exception e) {
      throw new ServletException(e);
    }
  }

  public void service(ServletRequest req, ServletResponse res)
    throws IOException ServletException
  {
    try {
      PrintWriter out = res.getWriter();

      Test test = home.findByPrimaryKey("test");

      out.println("test:" + test.hello());
    } catch (Exception e) {
      throw new ServletException(e);
    }
  }
}


Tutorials
EJB
Hessian Clients
Copyright © 1998-2005 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.