| <?xml version="1.0"?> |
| <document url="http://www.openejb.org/embedded.xml" toc="none"> |
| <properties> |
| <title>Accessing EJBs Remotely</title> |
| <sub-title>OpenEJB as a stand-alone server</sub-title> |
| </properties> |
| <body> |
| <sideimg src="images/diagram-remote-server.gif" width="240" height="500"/> |
| |
| <section title="Short version" ref-id="remote.access"> |
| <p> |
| Using OpenEJB's default remote server implementation is pretty straight forward. |
| You simply need to: |
| <ol> |
| <li>Deploy your bean.</li> |
| <li>Start the server on the IP and Port you want, 25.14.3.92 and 4201 for example.</li> |
| <li>Use that information in your client to create an initial context</li> |
| <li>Add the right jars to your client's classpath</li> |
| </ol> |
| </p> |
| |
| <p> |
| So, here it is in short. |
| </p> |
| |
| <p> |
| Deploy your bean with the |
| <a href="deploy.html">Deploy Tool</a>: |
| </p> |
| |
| <p> |
| <command>c:\openejb> openejb.bat deploy beans\myBean.jar</command> |
| </p> |
| <p> |
| See the Deploy Tool <a href="deploy.html">documentation</a> for more details on |
| deploying beans. |
| </p> |
| <p> |
| Start the server: |
| </p> |
| <p> |
| <command>c:\openejb> openejb.bat start -h 25.14.3.92 -p 4201</command> |
| </p> |
| <p> |
| See the Remote Server <a href="start-command.html">command-line guide</a> for more |
| details on starting the Remote Server. |
| </p> |
| <p> |
| Create an initial context in your client as such: |
| </p> |
| <code-block> |
| 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); |
| </code-block> |
| <p> |
| If you don't have any EJBs or clients to run, try the ubiquitous |
| <a href="hello-world.html">Hello World</a> example. |
| </p> |
| <p> |
| Add the following libraries to your clients classpath: |
| <ul> |
| <li>openejb-x.x.x.jar</li> |
| <li>openejb_client-x.x.x.jar</li> |
| </ul> |
| </p> |
| <p> |
| Both can be found in the <term>lib</term> directory where you installed OpenEJB. |
| </p> |
| </section> |
| |
| </body> |
| </document> |
| |