Resin-CMP JNDI Configuration
Resin 2.1

Reference Guide
EJB Reference Guide

EJBServer
JNDI
Entity Config
Relation Config
Session Config
Resin-EJB Config
SQL mapping
Transaction Config
Message Config
EJB-QL
xdoclet
Config Summary
Burlap
JMS
CORBA/IIOP
Index
EJBServer
EJB Reference Guide
Entity Config

The resource for the EJB Server itself is described in the EJBServer page. EJB Server is a JNDI resource.

Additional JNDI configuration is needed for using Burlap or Hessian clients. In other words, if you just need local beans, the EJBServer configuration is sufficient. If you need to use a remote bean, you need to configure the JNDI for the remote interface.

The remote Hessian factory is HessianContextFactory. The remote Burlap factory is BurlapContextFactory.

web.xml for Hessian
<web-app>
  <!-- Remote Hessian JNDI configuration -->
  <jndi-link>
    <jndi-name>java:comp/env/ejb</jndi-name>
    <jndi-factory>com.caucho.hessian.HessianContextFactory</jndi-factory>
    <init-param java.naming.provider.url="http://gryffindor/hessian"/>
  </jndi-link>
</web-app>

web.xml for Burlap
<web-app>
  <!-- Remote Burlap JNDI configuration -->
  <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://gryffindor/burlap"/>
  </jndi-link>
</web-app>

PropertyMeaning
jndi-linklinks a JNDI subtree into the main tree
jndi-namelocation in the main tree to link the subtree
jndi-factoryJNDI factory to create the subtree's root
java.naming.provider.urlEJB server URL

The local context factory will normally use a relative URL for java.naming.provider.url. That way, the client doesn't care about the server name or the web-app name. So local Resin-CMP servers and clients can be easily deployed as .war files.

Remote contexts need to know the full URL of the server, so they must be configured specifically for each server.

sample home lookup
private CourseHome;

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

    CourseHome = (CourseHome) cmp.lookup("course");
  } catch (NamingException e) {
    throw new ServletException(e);
  }
}


EJBServer
EJB Reference Guide
Entity Config
Copyright © 1998-2006 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.