Skip Headers

Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g Release 3 (10.1.3) B14428-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# What Type of Client Do You Have?

You can access an EJB from a variety of clients, including:

- EJB Client

- Stand-alone Java Client

- Servlet or JSP Client

How you access an EJB, resource, or environment variable is different depending on the type of client and how the application is assembled and deployed.

For more information, see "Configuring the Client".

## EJB Client

When one EJB (call it the source EJB) accesses another EJB (call it the target EJB), the source EJB is the client of the target EJB.

If you are using EJB 3.0, using annotations and dependency injection, OC4J initializes the instance variable that corresponds to the target reference.

If you are using EJB 2.1, you must use JNDI lookup in this scenario.

## Stand-alone Java Client

A stand-alone Java client is a client that executes outside of OC4J but accesses EJB resources deployed to OC4J.

Typically, a stand-alone Java client accesses EJB resources by making use of Java RMI calls. You must code a stand-alone Java client so that it honors the security and authentication requirements that OC4J enforces.

By default, OC4J is configured to assign RMI ports dynamically within a set range. In this release, you can look up an OC4J-deployed EJB from a stand-alone Java client without specifying an exact RMI port. You do not need to configure OC4J to use exact port numbers.

If you are using EJB 3.0, note that annotations and dependency injection is not supported for a stand-alone Java client.

If you are using EJB 2.1, you must configure your initial context to accommodate this scenario (see "Accessing an EJB 2.1 EJB Using RMI from a Stand-Alone Java Client").

## Servlet or JSP Client

A servlet or JSP can access an EJB.

OC4J does not support dependency injection in the web container. Consequently, you can only use JNDI lookup from a servlet or JSP client for both EJB 3.0 and EJB 2.1 applications.