Accessing EJBs Remotely -- OpenEJB as a stand-alone server

|  |  |  | OpenEJB OpenJMS OpenORB Castor Tyrex |

Main
Welcome!
Download
Mailing Lists
The Team

Users
Quickstart
Hello World!
CMP Example
CMP Guide
Deploy
Startup
Validation
Configuration
Support
Request Feature
FAQ

Servers
Local Server
Remote Server
Tomcat

Integrators
Why OpenEJB
Overview
Design
Specification
Presentation

Developers
Custom Services
Release Plan
Source Code
SourceForge

Accessing EJBs Remotely OpenEJB as a stand-alone server

## Short version

Using OpenEJB's default remote server implementation is pretty straight forward. You simply need to:

1. Deploy your bean.
2. Start the server on the IP and Port you want, 25.14.3.92 and 4201 for example.
3. Use that information in your client to create an initial context
4. Add the right jars to your client's classpath

So, here it is in short.

Deploy your bean with the Deploy Tool:

c:\openejb> openejb.bat deploy beans\myBean.jar

See the Deploy Tool documentation for more details on deploying beans.

Start the server:

c:\openejb> openejb.bat start -h 25.14.3.92 -p 4201

See the Remote Server command-line guide for more details on starting the Remote Server.

Create an initial context in your client as such:

    Properties p = new Properties();
    p.put("java.naming.factory.initial", "org.openejb.client.RemoteInitialContextFactory");
    p.put("java.naming.provider.url", "25.14.3.92:4201");
    p.put("java.naming.security.principal", "myuser");
    p.put("java.naming.security.credentials", "mypass");

    InitialContext ctx = new InitialContext(p);

If you don't have any EJBs or clients to run, try the ubiquitous Hello World example.

Add the following libraries to your clients classpath:

| openejb-x.x.x.jar
| openejb_client-x.x.x.jar

Both can be found in the lib directory where you installed OpenEJB.

Java, EJB, JDBC, JNDI, JTA, Sun, Sun Microsystems are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and in other countries. XML, XML Schema, XSLT and related standards are trademarks or registered trademarks of MIT, INRIA, Keio or others, and a product of the World Wide Web Consortium. All other product names mentioned herein are trademarks of their respective owners.