| ||
OC4J supports remote access from both J2SE and J2EE application clients .
A J2SE client is just a regular Java class that obtains an InitialContext and then looks up and uses J2EE components in the global Java Naming and Directory Interface (JNDI) namespace on the server. It doesn't require any extra server-side configuration, and thus it's ideal for simple throwaway clients (for example, test cases or one-time scripts) or for integration between loosely coupled applications.
A J2EE client is more powerful and portable, but must be described ahead of time in an application-client .xml descriptor packaged inside a client module in your enterprise archive (EAR) file. Through this descriptor, you can configure environment entries, EJB references and resource references ( DataSource s, Java Message Service (JMS) destinations, and mail sessions) in a local JNDI namespace instead of forcing the client to rely on global locations. You can also configure a Java Authentication and Authorization Service (JAAS) callback handler that will provide seamless authentication through server-independent security code. Table 14-1 compares J2EE and J2SE clients.
Type | J2SE Client | J2EE Client |
---|---|---|
Server-side configuration | None | application-client.xml descriptor inside the deployed EAR |
JNDI InitialContextFactory | RMIInitialContextFactory | ApplicationClientInitialContextFactory |
Pros | Loosely coupled with deployed application, no server-side configuration | More portable across application servers, easier integration with JAAS security |
Ideal for | Test clients, one-time batch scripts, integration of loosely coupled applications | Swing user interfaces, scheduled processes, tightly coupled clients |
Both types of clients are invoked directly (outside the container). However, since both rely on classes found in OC4J Java archive (JAR) files, you'll need to make sure that OC4J JARs are accessible on the classpath.
| ||