You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by db...@apache.org on 2006/09/27 09:53:19 UTC

svn commit: r450370 [9/29] - /incubator/openejb/trunk/website/html/

Added: incubator/openejb/trunk/website/html/embedding-openejb.html
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/website/html/embedding-openejb.html?view=auto&rev=450370
==============================================================================
--- incubator/openejb/trunk/website/html/embedding-openejb.html (added)
+++ incubator/openejb/trunk/website/html/embedding-openejb.html Wed Sep 27 00:53:16 2006
@@ -0,0 +1,523 @@
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+ <HEAD>
+  <!-- $PAGETITLE -->
+  <TITLE>OpenEJB - Embedding OpenEJB</TITLE>
+  <LINK href="http://people.apache.org/~dblevins/openejb/default.css" rel="stylesheet" type="text/css">
+  <LINK href="http://people.apache.org/~dblevins/openejb/style.css" rel="stylesheet" type="text/css">
+  <LINK rel="SHORTCUT ICON" href="http://incubator.apache.org/openejb/images/favicon.ico">
+  <SCRIPT language="JavaScript" src="http://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=OPENEJB&title=functions.js" type="text/javascript"></SCRIPT>
+ <META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
+  <BODY bgcolor="#ffffff" link="#6763a9" vlink="#6763a9" topmargin="0" bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0">
+  <A name="top"></A>
+  <TABLE border="0" cellpadding="0" cellspacing="0" width="100%" height="400">
+   <TR>
+    <TD width="20" valign="top" align="left" bgcolor="#7270c2"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
+    <TD width="95" valign="top" align="left" bgcolor="#7270c2"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
+    <TD width="7" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="40" height="6" border="0"></TD>
+    <TD width="100%" valign="top" align="left" bgcolor="#5A5CB8"><IMG src="http://incubator.apache.org/openejb/images/top_2.gif" width="430" height="6" border="0"></TD>
+    <TD width="120" valign="top" align="left" bgcolor="#E24717"><IMG src="http://incubator.apache.org/openejb/images/top_3.gif" width="120" height="6" border="0"></TD>
+   </TR>
+   <TR>
+    <TD width="20" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
+    <TD width="95" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
+    <TD width="7" bgcolor="#ffffff" valign="top" align="left"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
+    <TD id="breadcrumbs" width="100%" valign="middle" align="left">
+      <!-- $TOP_NAV_BAR -->
+      <SPAN id="Content">
+        
+            
+                                                                                                                                                                                    
+                                    
+                                                
+            <A href="index.html" title="Index">Index</A> | <A href="news.html" title="News">News</A> | <A href="faq.html" title="FAQ">FAQ</A> | <A href="download.html" title="Download">Download</A> | <A href="mailing-lists.html" title="Mailing Lists">Lists</A> | <SPAN class="nobr"><A href="http://issues.apache.org/jira/browse/OPENEJB" title="Visit page outside Confluence" rel="nofollow">Issues<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      </SPAN>
+     <IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="2" border="0"></TD>
+    <TD width="120" height="20" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR>
+    <TD width="20" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="20" height="3" border="0"></TD>
+    <TD width="95" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_sm.gif" width="105" height="3" border="0"></TD>
+    <TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_sm.gif" width="7" height="3" border="0"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_light.gif" width="40" height="3" border="0"></TD>
+    <TD width="100%" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_light.gif" width="430" height="3" border="0"></TD>
+    <TD width="120" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
+   </TR>
+   <TR>
+    <TD bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="20" height="10" border="0"></TD>
+    <TD id="leftColumn" valign="top" style="padding-top: 0px;">
+    <SPAN id="Content">
+      
+            
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
+                                    
+                                                
+            <H3><A name="Navigation-Overview"></A>Overview</H3>
+<UL class="alternate" type="square">
+	<LI><A href="index.html" title="Index">Home</A></LI>
+	<LI><A href="news.html" title="News">News</A></LI>
+	<LI><A href="faq.html" title="FAQ">FAQ</A></LI>
+	<LI><A href="download.html" title="Download">Download</A></LI>
+	<LI><A href="quickstart.html" title="Quickstart">Quickstart</A></LI>
+	<LI><A href="mailing-lists.html" title="Mailing Lists">Mailing Lists</A></LI>
+	<LI><A href="source-code.html" title="Source Code">Source Code</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-General"></A>General</H3>
+<UL class="alternate" type="square">
+	<LI><A href="deploy-tool.html" title="Deploy Tool">Deployment</A></LI>
+	<LI><A href="startup.html" title="Startup">Startup</A></LI>
+	<LI><A href="validation-tool.html" title="Validation Tool">Validation</A></LI>
+	<LI><A href="webadmin.html" title="Webadmin">Webadmin</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Configuration"></A>Configuration</H3>
+<UL class="alternate" type="square">
+	<LI><A href="configuration.html" title="Configuration">General</A></LI>
+	<LI><A href="deployments.html" title="Deployments">Deployments</A></LI>
+	<LI><A href="containers.html" title="Containers">Containers</A></LI>
+	<LI><A href="castor-cmp.html" title="Castor CMP">Castor CMP</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Servers"></A>Servers</H3>
+<UL class="alternate" type="square">
+	<LI><A href="local-server.html" title="Local Server">Local</A></LI>
+	<LI><A href="remote-server.html" title="Remote Server">Remote</A></LI>
+</UL>
+
+
+
+<H3><A name="Navigation-Integrations"></A>Integrations</H3>
+<UL class="alternate" type="square">
+	<LI><A href="tomcat.html" title="Tomcat">Tomcat</A></LI>
+	<LI><A href="geronimo.html" title="Geronimo">Geronimo</A></LI>
+	<LI><A href="webobjects.html" title="WebObjects">WebObjects</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Community"></A>Community</H3>
+<UL class="alternate" type="square">
+	<LI><A href="team.html" title="Team">Team</A></LI>
+	<LI><A href="help.html" title="Help">Help</A></LI>
+	<LI><A href="articles.html" title="Articles">Articles</A></LI>
+	<LI><A href="annoyances.html" title="Annoyances">Annoyances</A></LI>
+</UL>
+                                                                                                                                                                                                                </SPAN>
+
+            <H3 class="heading3">Feeds</H3>
+            <TABLE border="0" cellspacing="4px">
+            <TR>
+              <TD align="right">
+                <A href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false"><IMG src="http://incubator.apache.org/openejb/images/rss.gif" border="0"></A><BR>
+              </TD>
+              <TD align="left">
+                <A href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false">Site</A>
+              </TD>
+            </TR>
+            <TR>
+              <TD align="right">
+                <A href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB"><IMG src="http://incubator.apache.org/openejb/images/rss.gif" border="0"></A>
+              </TD>
+              <TD align="left">
+                <A href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB">News</A>
+              </TD>
+            </TR>
+            </TABLE>
+        </TD>
+    <TD width="7" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
+    <TD width="40" valign="top" align="left">&nbsp;</TD>
+    <TD rowspan="4" width="100%" valign="top">
+     <TABLE cols="1" rows="2" border="0" cellpadding="0" cellspacing="0" width="100%">
+      <TR>
+       <TD valign="top" align="left"><BR>
+          <TABLE cols="3" rows="1" border="0" cellpadding="0" cellspacing="0" width="100%">
+          <TR>
+           <TD valign="top" width="200" align="left">
+           <A href="http://openejb.org/">
+           <IMG border="0" hspace="0" src="http://incubator.apache.org/openejb/images/logo_openejb.gif" vspace="0">
+           </A>
+           </TD>
+           <TD align="right" valign="middle" style="padding:0px;margin:0px;">
+	      <TABLE style="padding:0px;margin:0px;">
+            <TR>
+                <TD>
+	            <A href="http://incubator.apache.org/">
+	              <IMG src="http://incubator.apache.org/images/apache-incubator-logo.png" border="0">
+	            </A>
+                </TD>
+            <TR>
+<!--
+	        <tr>
+	            <td align="right" valign="top" style="font- size:12px;color:#777777">
+	            [OpenEJB is a Podling in the Apache Incubator]
+	            </td>
+	        </tr>
+-->
+          </TABLE>
+           </TD>
+          </TR>
+          </TABLE>
+	<BR>
+      </TD>
+      </TR>
+      <TR>
+       <TD valign="top" align="left">
+         <IMG border="0" height="7" hspace="0" src="http://incubator.apache.org/openejb/images/dotTrans.gif"><BR>
+          <DIV id="page_title">
+            <TABLE width="100%">
+              <TR>
+                <TD>
+	<!-- $TITLE -->
+	Embedding OpenEJB
+                </TD>
+                 <TD align="right" style="padding-left:0px;"><A style="color:#999;font-size:small;font-weight:normal;" href="http://cwiki.apache.org/confluence/pages/editpage.action?spaceKey=OPENEJB&title=Embedding%20OpenEJB">[ edit ]</A></TD>
+                <TD align="right" width="25">
+
+            <SCRIPT type="text/javascript" language="javascript">
+                document.write('<a href="http://cwiki.apache.org/confluence/pages/viewpage');
+                document.write('.action?pageId=26480&decorator=printable">');
+            </SCRIPT>
+            <IMG src="http://cwiki.apache.org/confluence/images/icons/print_16.gif" height="16" width="16" border="0" align="absmiddle" title="Print"></A>
+
+                </TD>
+              </TR>
+            </TABLE>
+          </DIV>
+        <IMG border="0" height="1" hspace="0" src="http://incubator.apache.org/openejb/images/dotTrans.gif"></TD>
+      </TR>
+     </TABLE>
+     <P>
+     <!-- $BODY -->
+            <DIV id="PageContent">
+        
+        <DIV class="pagecontent">
+            <DIV class="wiki-content">
+                
+<P>OpenEJB embedded in your app, server, IDE, or JUnit</P>
+<H1><A name="EmbeddingOpenEJB-Saywhat%3F%21Alocalserver%3F"></A>Say what?! A local server?</H1>
+
+
+<P>Yes, you read correctly. OpenEJB can be embedded and treated as your very own personal EJB container.</P>
+
+<P>If they can have Local and Remote EJB&apos;s, why not Local and Remote EJB Servers too?</P>
+
+<P>Haven&apos;t you ever wanted EJBs without the heavy? I mean you need the &quot;heavy&quot; eventually, but not while you&apos;re developing. Well, there&apos;s the advantage of an EJB implementation that was designed with a very clean and well defined server-container contract, you can cut the server part out completely!</P>
+
+<P>So, if you wish to access ejbs locally and not in client/server mode, you can do so by embedding OpenEJB as a library and accessing ejbs through OpenEJB&apos;s built-in IntraVM (Local) Server. Why would someone want to do this?* Your application is a server or other middleware</P>
+<UL>
+	<LI>You want to write an app that can be both stand alonedistributed</LI>
+	<LI>To test your EJBs with JUnit and don&apos;t want to start/stop servers and other nonsense</LI>
+	<LI>Imagine the power from being able to use your IDE debugger to step from your Client all the way into your EJB and back with no remote debugging voodoo.</LI>
+</UL>
+
+
+
+<P>In this case, your application, test suite, IDE, or client accesses beans as you would from any other EJB Server. The EJB Server just happens to be running in the same virtual machine as your application. This EJB Server is thusly called the IntraVM Server, and, for all intense purposes, your application an IntraVM Client.</P>
+
+<P>There are some interesting differences though. The IntraVM Server isn&apos;t a heavyweight server as one normally associates with EJB. It doesn&apos;t open connections, launch threads for processing requests, introduce complex classloading heirarchies, or any of those &quot;heavy&quot; kind of things. All it does is dish out proxies to your app that can be used to shoot calls right into the EJB Container. Very light, very fast, very easy for testing, debugging, developing, etc.</P>
+
+<H1><A name="EmbeddingOpenEJB-AccessingEJBslocally"></A>Accessing EJBs locally</H1>
+
+
+<P>Try something like this for a simple IntraVM (Local) Client:</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>c:myappMyEjbApplication.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">import</SPAN> java.util.Properties;
+<SPAN class="code-keyword">import</SPAN> javax.naming.Context;
+<SPAN class="code-keyword">import</SPAN> javax.naming.InitialContext;
+<SPAN class="code-keyword">import</SPAN> javax.rmi.PortableRemoteObject;
+<SPAN class="code-keyword">import</SPAN> FooHome;
+
+<SPAN class="code-keyword">public</SPAN> class MyEjbApplication {
+
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main( <SPAN class="code-object">String</SPAN> args[]) {
+  <SPAN class="code-keyword">try</SPAN>{
+    
+    Properties properties = <SPAN class="code-keyword">new</SPAN> Properties();
+    
+    properties.put(Context.INITIAL_CONTEXT_FACTORY, 
+        <SPAN class="code-quote">&quot;org.openejb.client.LocalInitialContextFactory&quot;</SPAN>);
+    
+    InitialContext ctx = <SPAN class="code-keyword">new</SPAN> InitialContext(properties);
+    
+    <SPAN class="code-object">Object</SPAN> obj = ctx.lookup(<SPAN class="code-quote">&quot;my/bean/Foo&quot;</SPAN>);
+    
+    FooHome ejbHome = (FooHome)
+        PortableRemoteObject.narrow(obj, FooHome.class);
+  
+  } <SPAN class="code-keyword">catch</SPAN> (Exception e){
+    e.printStackTRace();
+  }
+}
+}</PRE>
+</DIV></DIV>
+
+
+
+<P>That would be the simplest spec compliant client you could create. If you don&apos;t care about spec compliance and just want to &quot;cheat&quot;, you can do this:</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>c:myappMyEjbApplication.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">import</SPAN> javax.naming.InitialContext;
+<SPAN class="code-keyword">import</SPAN> FooHome;
+
+<SPAN class="code-keyword">public</SPAN> class MyEjbApplication {
+
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main( <SPAN class="code-object">String</SPAN> args[]) {
+  <SPAN class="code-keyword">try</SPAN>{
+    
+    FooHome ejbHome = (FooHome)<SPAN class="code-keyword">new</SPAN> InitialContext().lookup(
+                            <SPAN class="code-quote">&quot;java:openejb/ejb/my/bean/Foo&quot;</SPAN>);
+  
+  } <SPAN class="code-keyword">catch</SPAN> (Exception e){
+    e.printStackTRace();
+  }
+}
+}</PRE>
+</DIV></DIV>
+
+
+
+<P>Now keep in mind, that is not spec compliant. Also keep in mind that we provide it as a convenience, so if there is something you don&apos;t like or think should be changed, send code.</P>
+
+<H1><A name="EmbeddingOpenEJB-Passinginitializationparameters"></A>Passing initialization parameters</H1>
+
+
+<P>When accessing OpenEJB in local (intra-vm) mode, the IntraVM server will instantiate OpenEJB for you. When it instantiates OpenEJB, it puts default values for the items in the Properties object OpenEJB needs to actually instantiate.</P>
+
+<P>If you want to pass OpenEJB specific parameters, you can do this in two ways:* Call init yourself before any JNDI calls are made</P>
+<UL>
+	<LI>Pass the parameters in the InitialContext hashtable</LI>
+</UL>
+
+
+
+<P>Refer to the <SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=OPENEJB&title=spec.html&linkCreation=true&fromPageId=26480" title="Create Page: spec.html" class="createlink">OpenEJB Specification<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/plus.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> for information on the init method or the parameters you can pass to OpenEJB.</P>
+
+<P>Here is an example of passing the initialization parameters in to OpenEJB via the first InitialContext creation. I stress, this is only applicable the very first time and InitialContext is created within your Virtual Machine. After that, OpenEJB will have been initialized and the parameters will be ignored.</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>c:myappMyEjbApplication.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">import</SPAN> FooHome;
+<SPAN class="code-keyword">import</SPAN> java.util.Properties;
+<SPAN class="code-keyword">import</SPAN> javax.naming.Context;
+<SPAN class="code-keyword">import</SPAN> javax.naming.InitialContext;
+<SPAN class="code-keyword">import</SPAN> javax.rmi.PortableRemoteObject;
+
+<SPAN class="code-keyword">public</SPAN> class MyEjbApplication {
+
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main( <SPAN class="code-object">String</SPAN> args[]) {
+  <SPAN class="code-keyword">try</SPAN>{
+    
+    Properties p = <SPAN class="code-keyword">new</SPAN> Properties();
+    
+    p.put(Context.INITIAL_CONTEXT_FACTORY, 
+          <SPAN class="code-quote">&quot;org.openejb.client.LocalInitialContextFactory&quot;</SPAN>);
+    
+    p.put(<SPAN class="code-quote">&quot;openejb.home&quot;</SPAN>, <SPAN class="code-quote">&quot;c:\\dir\\openejb&quot;</SPAN>);
+    
+    p.put(<SPAN class="code-quote">&quot;openejb.configuration&quot;</SPAN>, 
+          <SPAN class="code-quote">&quot;c:\\my\\app\\conf\\openejb.conf&quot;</SPAN>);
+    
+    InitialContext ctx = <SPAN class="code-keyword">new</SPAN> InitialContext( p );
+    
+    <SPAN class="code-object">Object</SPAN> obj = ctx.lookup(<SPAN class="code-quote">&quot;my/bean/Foo&quot;</SPAN>);
+    
+    FooHome ejbHome = (FooHome)
+        PortableRemoteObject.narrow(obj,FooHome.class);
+  
+  } <SPAN class="code-keyword">catch</SPAN> (Exception e){
+    e.printStackTRace();
+  }
+}
+}</PRE>
+</DIV></DIV>
+
+
+
+<H1><A name="EmbeddingOpenEJB-Settheopenejb.homevariable"></A>Set the openejb.home variable</H1>
+
+
+<P>If you use OpenEJB Local Server, you are actually using OpenEJB as an embedded library. This means when your application starts, OpenEJB will be starting too, in your virtual machine. Odds are you will not want to execute your application in the directory where OpenEJB was installed, but will want to execute your application where you are developing it. This is fine, but you will need to tell OpenEJB where it was installed. To do this, set the &quot;openejb.home&quot; system variable.</P>
+
+<P>For example, if OpenEJB was unpacked in the directory in c:\dir\openejb, you can set the openejb.home variable as a java vm flag as follows.</P>
+
+<P><TT>c:\my\app&gt; java -Dopenejb.home=c:\dir\openejb MyEjbApplication</TT></P>
+
+
+<P>You can also set the openejb.home variable by calling System.setProperty(...) in your application before any calls to the OpenEJB Local Server are made.</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>c:myappMyEjbApplication.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java">...
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main(<SPAN class="code-object">String</SPAN> args[]) {
+    
+  <SPAN class="code-object">System</SPAN>.setProperty(<SPAN class="code-quote">&quot;openejb.home&quot;</SPAN>, <SPAN class="code-quote">&quot;c:\\dir\\openejb&quot;</SPAN>);
+  ...
+  
+}
+...</PRE>
+</DIV></DIV>
+
+
+
+<P>As mentioned above, you can pass OpenEJB parameters on your first call to the Local Server.</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>c:myappMyEjbApplication.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java">...
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main( <SPAN class="code-object">String</SPAN> args[]) {
+    
+  Properties p = <SPAN class="code-keyword">new</SPAN> Properties();
+  
+  p.put(Context.INITIAL_CONTEXT_FACTORY, 
+        <SPAN class="code-quote">&quot;org.openejb.client.LocalInitialContextFactory&quot;</SPAN>);
+  
+  p.put(<SPAN class="code-quote">&quot;openejb.home&quot;</SPAN>, <SPAN class="code-quote">&quot;c:\\dir\\openejb&quot;</SPAN>);
+      
+  InitialContext ctx = <SPAN class="code-keyword">new</SPAN> InitialContext( p );
+  ...
+}
+...</PRE>
+</DIV></DIV>
+
+
+
+<P>When OpenEJB is started, it will look for its configuration files in the OPENJB_HOME/conf directory. The paths to beans in your openejb.conf file are also resolved relative to the openejb.home variable.</P>
+
+<H1><A name="EmbeddingOpenEJB-EmbeddedOpenEJBFAQ"></A>Embedded OpenEJB FAQ</H1>
+
+
+<H2><A name="EmbeddingOpenEJB-Whatdoyoumeanembedded%3F"></A>What do you mean embedded?</H2>
+
+
+<P>When your clients run OpenEJB in the same VM using the IntraVM Server, you&apos;re using OpenEJB as an embedded EJB Server just like InstantDB and Cloudscape are embedded databases servers. Just like InstantDB and Cloudscape, OpenEJB needs configuration files and other files to do it&apos;s job.</P>
+
+<P>OpenEJB is the only EJB server that I know of that you can run as an embedded library, so the fact that you can even do it is a real feather in our cap. If anyone knows of another, please tell me.</P>
+
+<P>In fact, anyone already using InstantDB or Cloudscape as embedded database servers in a product could just as easily use OpenEJB as an embedded EJB Server and add instant EJB support to the product as well. OpenEJB can easily play with InstantDB or Cloudscape, so it would be pretty slick. This would be extremely useful for IDEs like Visual Cafe, JBuilder, Visual Age, etc.</P>
+
+<H2><A name="EmbeddingOpenEJB-Moreinfoonopenejb.conffiles"></A>More info on openejb.conf files</H2>
+
+
+<P>Here is an example of this. The openejb.home variable, which we will refer to as OPENEJB_HOME, is set to &quot;c:\dir\openejb&quot;. The following relative path in your openejb.conf file will be resolved assuming OPENEJB_HOME as the base path.</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
+...
+
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
+</DIV></DIV>
+
+
+
+<P>The above deployment path, &quot;beans\&quot;, would automatically be expanded to &quot;c:\dir\openejb\beans&quot;.</P>
+
+<P>If you want tell OpenEJB to look outside the OPENEJB_HOME, then use an absolute file path as shown below.</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
+...
+
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans\&quot;</SPAN> /&gt;</SPAN><SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
+</DIV></DIV>
+
+
+
+<P>OpenEJB can look in any number of directories for beans, just add those directories to your openejb.conf file as such.</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
+...
+
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\app\my\beans\&quot;</SPAN> /&gt;</SPAN><SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
+</DIV></DIV>
+
+
+
+<P>Furthermore, you can add jars individually to OpenEJB&apos;s deployment path by naming the jar directly.</P>
+
+
+<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
+...
+
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\app\my\beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\special\beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\foo\ejbs\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;d:\files\ejbjars\&quot;</SPAN> /&gt;</SPAN><SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
+</DIV></DIV>
+
+
+            </DIV>
+        </DIV>
+    </DIV>
+     </P>
+    </TD>
+<!--    <td width="120" height="5" valign="top" align="left"></td>   -->
+
+   </TR>
+   <TR height="5">
+    <TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
+    <TD width="95" height="5" bgcolor="#7270c2" valign="top">&nbsp;</TD>
+    <TD width="7" height="5" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
+    <TD width="40" height="5" valign="top" align="left">&nbsp;</TD>
+    <TD width="120" height="5" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR>
+    <TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
+    <TD width="95" bgcolor="#7270c2" valign="BOTTOM" align="left">&nbsp;</TD>
+    <TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
+    <TD width="120" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR>
+    <TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
+    <TD width="95" bgcolor="#7270c2" valign="BOTTOM" align="left">&nbsp;</TD>
+    <TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
+    <TD width="120" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR height="5">
+    <TD width="20" rowspan="2" height="100%" bgcolor="#7270c2" valign="bottom" align="left"><IMG src="http://incubator.apache.org/openejb/images/stripes1.gif" width="20" height="125" border="0"></TD>
+    <TD width="95" rowspan="2" height="100%" bgcolor="#7270c2" valign="bottom" align="left"><IMG src="http://incubator.apache.org/openejb/images/stripe105.gif" width="105" height="125" border="0"></TD>
+    <TD width="7" rowspan="2" height="100%" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
+    <TD width="40" height="100%" valign="top" align="left">&nbsp;</TD>
+    <TD width="120" height="100%" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR height="5">
+    <TD width="40" height="25" valign="top" align="left">&nbsp;</TD>
+    <TD width="100%" height="25" valign="bottom" align="left"><BR>
+     <BR>
+     <IMG src="http://incubator.apache.org/openejb/images/line_light.gif" border="0" width="430" height="3"><BR>
+     <P>
+     </P>
+     <SPAN class="bodyGrey">
+     <SMALL><NOTICE><!-- $FOOTER -->
+Apache OpenEJB is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Geronimo PMC. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+     </NOTICE> <BR>
+     &nbsp;<BR>
+          Powered by <A href="http://atlassian.com/">Atlassian</A> <A href="http://atlassian.com/confluence/">Confluence</A>.
+     </SMALL>
+     </SPAN>
+     <P>
+     </P>
+     </TD>
+    <TD width="120" height="25" valign="top" align="left">&nbsp;</TD>
+   </TR>
+  </TABLE>
+  </BODY>
+ </HTML>

Added: incubator/openejb/trunk/website/html/embedding.html
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/website/html/embedding.html?view=auto&rev=450370
==============================================================================
--- incubator/openejb/trunk/website/html/embedding.html (added)
+++ incubator/openejb/trunk/website/html/embedding.html Wed Sep 27 00:53:16 2006
@@ -0,0 +1,411 @@
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+ <HEAD>
+  <!-- $PAGETITLE -->
+  <TITLE>OpenEJB - Embedding</TITLE>
+  <LINK href="http://people.apache.org/~dblevins/openejb/default.css" rel="stylesheet" type="text/css">
+  <LINK href="http://people.apache.org/~dblevins/openejb/style.css" rel="stylesheet" type="text/css">
+  <LINK rel="SHORTCUT ICON" href="http://incubator.apache.org/openejb/images/favicon.ico">
+  <SCRIPT language="JavaScript" src="http://cwiki.apache.org/confluence/pages/viewpage.action?spaceKey=OPENEJB&title=functions.js" type="text/javascript"></SCRIPT>
+ <META http-equiv="Content-Type" content="text/html;charset=UTF-8"></HEAD>
+  <BODY bgcolor="#ffffff" link="#6763a9" vlink="#6763a9" topmargin="0" bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0">
+  <A name="top"></A>
+  <TABLE border="0" cellpadding="0" cellspacing="0" width="100%" height="400">
+   <TR>
+    <TD width="20" valign="top" align="left" bgcolor="#7270c2"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
+    <TD width="95" valign="top" align="left" bgcolor="#7270c2"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
+    <TD width="7" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="40" height="6" border="0"></TD>
+    <TD width="100%" valign="top" align="left" bgcolor="#5A5CB8"><IMG src="http://incubator.apache.org/openejb/images/top_2.gif" width="430" height="6" border="0"></TD>
+    <TD width="120" valign="top" align="left" bgcolor="#E24717"><IMG src="http://incubator.apache.org/openejb/images/top_3.gif" width="120" height="6" border="0"></TD>
+   </TR>
+   <TR>
+    <TD width="20" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
+    <TD width="95" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
+    <TD width="7" bgcolor="#ffffff" valign="top" align="left"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="1" border="0"></TD>
+    <TD id="breadcrumbs" width="100%" valign="middle" align="left">
+      <!-- $TOP_NAV_BAR -->
+      <SPAN id="Content">
+        
+            
+                                                                                                                                                                                    
+                                    
+                                                
+            <A href="index.html" title="Index">Index</A> | <A href="news.html" title="News">News</A> | <A href="faq.html" title="FAQ">FAQ</A> | <A href="download.html" title="Download">Download</A> | <A href="mailing-lists.html" title="Mailing Lists">Lists</A> | <SPAN class="nobr"><A href="http://issues.apache.org/jira/browse/OPENEJB" title="Visit page outside Confluence" rel="nofollow">Issues<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      </SPAN>
+     <IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="2" border="0"></TD>
+    <TD width="120" height="20" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR>
+    <TD width="20" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="20" height="3" border="0"></TD>
+    <TD width="95" bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_sm.gif" width="105" height="3" border="0"></TD>
+    <TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_sm.gif" width="7" height="3" border="0"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_light.gif" width="40" height="3" border="0"></TD>
+    <TD width="100%" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/line_light.gif" width="430" height="3" border="0"></TD>
+    <TD width="120" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" border="0" width="1" height="1"></TD>
+   </TR>
+   <TR>
+    <TD bgcolor="#7270c2" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="20" height="10" border="0"></TD>
+    <TD id="leftColumn" valign="top" style="padding-top: 0px;">
+    <SPAN id="Content">
+      
+            
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
+                                    
+                                                
+            <H3><A name="Navigation-Overview"></A>Overview</H3>
+<UL class="alternate" type="square">
+	<LI><A href="index.html" title="Index">Home</A></LI>
+	<LI><A href="news.html" title="News">News</A></LI>
+	<LI><A href="faq.html" title="FAQ">FAQ</A></LI>
+	<LI><A href="download.html" title="Download">Download</A></LI>
+	<LI><A href="quickstart.html" title="Quickstart">Quickstart</A></LI>
+	<LI><A href="mailing-lists.html" title="Mailing Lists">Mailing Lists</A></LI>
+	<LI><A href="source-code.html" title="Source Code">Source Code</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-General"></A>General</H3>
+<UL class="alternate" type="square">
+	<LI><A href="deploy-tool.html" title="Deploy Tool">Deployment</A></LI>
+	<LI><A href="startup.html" title="Startup">Startup</A></LI>
+	<LI><A href="validation-tool.html" title="Validation Tool">Validation</A></LI>
+	<LI><A href="webadmin.html" title="Webadmin">Webadmin</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Configuration"></A>Configuration</H3>
+<UL class="alternate" type="square">
+	<LI><A href="configuration.html" title="Configuration">General</A></LI>
+	<LI><A href="deployments.html" title="Deployments">Deployments</A></LI>
+	<LI><A href="containers.html" title="Containers">Containers</A></LI>
+	<LI><A href="castor-cmp.html" title="Castor CMP">Castor CMP</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Servers"></A>Servers</H3>
+<UL class="alternate" type="square">
+	<LI><A href="local-server.html" title="Local Server">Local</A></LI>
+	<LI><A href="remote-server.html" title="Remote Server">Remote</A></LI>
+</UL>
+
+
+
+<H3><A name="Navigation-Integrations"></A>Integrations</H3>
+<UL class="alternate" type="square">
+	<LI><A href="tomcat.html" title="Tomcat">Tomcat</A></LI>
+	<LI><A href="geronimo.html" title="Geronimo">Geronimo</A></LI>
+	<LI><A href="webobjects.html" title="WebObjects">WebObjects</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Community"></A>Community</H3>
+<UL class="alternate" type="square">
+	<LI><A href="team.html" title="Team">Team</A></LI>
+	<LI><A href="help.html" title="Help">Help</A></LI>
+	<LI><A href="articles.html" title="Articles">Articles</A></LI>
+	<LI><A href="annoyances.html" title="Annoyances">Annoyances</A></LI>
+</UL>
+                                                                                                                                                                                                                </SPAN>
+
+            <H3 class="heading3">Feeds</H3>
+            <TABLE border="0" cellspacing="4px">
+            <TR>
+              <TD align="right">
+                <A href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false"><IMG src="http://incubator.apache.org/openejb/images/rss.gif" border="0"></A><BR>
+              </TD>
+              <TD align="left">
+                <A href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false">Site</A>
+              </TD>
+            </TR>
+            <TR>
+              <TD align="right">
+                <A href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB"><IMG src="http://incubator.apache.org/openejb/images/rss.gif" border="0"></A>
+              </TD>
+              <TD align="left">
+                <A href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB">News</A>
+              </TD>
+            </TR>
+            </TABLE>
+        </TD>
+    <TD width="7" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
+    <TD width="40" valign="top" align="left">&nbsp;</TD>
+    <TD rowspan="4" width="100%" valign="top">
+     <TABLE cols="1" rows="2" border="0" cellpadding="0" cellspacing="0" width="100%">
+      <TR>
+       <TD valign="top" align="left"><BR>
+          <TABLE cols="3" rows="1" border="0" cellpadding="0" cellspacing="0" width="100%">
+          <TR>
+           <TD valign="top" width="200" align="left">
+           <A href="http://openejb.org/">
+           <IMG border="0" hspace="0" src="http://incubator.apache.org/openejb/images/logo_openejb.gif" vspace="0">
+           </A>
+           </TD>
+           <TD align="right" valign="middle" style="padding:0px;margin:0px;">
+	      <TABLE style="padding:0px;margin:0px;">
+            <TR>
+                <TD>
+	            <A href="http://incubator.apache.org/">
+	              <IMG src="http://incubator.apache.org/images/apache-incubator-logo.png" border="0">
+	            </A>
+                </TD>
+            <TR>
+<!--
+	        <tr>
+	            <td align="right" valign="top" style="font- size:12px;color:#777777">
+	            [OpenEJB is a Podling in the Apache Incubator]
+	            </td>
+	        </tr>
+-->
+          </TABLE>
+           </TD>
+          </TR>
+          </TABLE>
+	<BR>
+      </TD>
+      </TR>
+      <TR>
+       <TD valign="top" align="left">
+         <IMG border="0" height="7" hspace="0" src="http://incubator.apache.org/openejb/images/dotTrans.gif"><BR>
+          <DIV id="page_title">
+            <TABLE width="100%">
+              <TR>
+                <TD>
+	<!-- $TITLE -->
+	Embedding
+                </TD>
+                 <TD align="right" style="padding-left:0px;"><A style="color:#999;font-size:small;font-weight:normal;" href="http://cwiki.apache.org/confluence/pages/editpage.action?spaceKey=OPENEJB&title=Embedding">[ edit ]</A></TD>
+                <TD align="right" width="25">
+
+            <SCRIPT type="text/javascript" language="javascript">
+                document.write('<a href="http://cwiki.apache.org/confluence/pages/viewpage');
+                document.write('.action?pageId=26533&decorator=printable">');
+            </SCRIPT>
+            <IMG src="http://cwiki.apache.org/confluence/images/icons/print_16.gif" height="16" width="16" border="0" align="absmiddle" title="Print"></A>
+
+                </TD>
+              </TR>
+            </TABLE>
+          </DIV>
+        <IMG border="0" height="1" hspace="0" src="http://incubator.apache.org/openejb/images/dotTrans.gif"></TD>
+      </TR>
+     </TABLE>
+     <P>
+     <!-- $BODY -->
+            <DIV id="PageContent">
+        
+        <DIV class="pagecontent">
+            <DIV class="wiki-content">
+                
+<P>When your clients run OpenEJB in the same VM using the IntraVM Server, you&apos;re using OpenEJB as an embedded EJB Server just like InstantDB and Cloudscape are embedded databases servers. Just like InstantDB and Cloudscape, OpenEJB needs configuration files and other files to do it&apos;s job.</P>
+
+
+<P>When accessing OpenEJB in local (intra-vm) mode, the IntraVM server will instantiate OpenEJB for you. When it instantiates OpenEJB, it puts default values for the items in the Properties object OpenEJB needs to actually instantiate.</P>
+
+<H1><A name="Embedding-Noplacelikehome"></A>No place like home</H1>
+
+<P>Passing initialization parameters</P>
+
+<P>When accessing OpenEJB in local (intra-vm) mode, the IntraVM server will instantiate OpenEJB for you. When it instantiates OpenEJB, it puts default values for the items in the Properties object OpenEJB needs to actually instantiate.</P>
+
+<P>If you want to pass OpenEJB specific parameters, you can do this in two ways:<BR>
+Call init yourself before any JNDI calls are made<BR>
+Pass the parameters in the InitialContext hashtable</P>
+
+<P>Refer to the OpenEJB Specification for information on the init method or the parameters you can pass to OpenEJB.</P>
+
+<P>Here is an example of passing the initialization parameters in to OpenEJB via the first InitialContext creation. I stress, this is only applicable the very first time and InitialContext is created within your Virtual Machine. After that, OpenEJB will have been initialized and the parameters will be ignored.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>MyEjbApplication.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">import</SPAN> FooHome;
+<SPAN class="code-keyword">import</SPAN> java.util.Properties;
+<SPAN class="code-keyword">import</SPAN> javax.naming.Context;
+<SPAN class="code-keyword">import</SPAN> javax.naming.InitialContext;
+<SPAN class="code-keyword">import</SPAN> javax.rmi.PortableRemoteObject;
+
+<SPAN class="code-keyword">public</SPAN> class MyEjbApplication {
+
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main( <SPAN class="code-object">String</SPAN> args[]) {
+  <SPAN class="code-keyword">try</SPAN>{
+    
+    Properties p = <SPAN class="code-keyword">new</SPAN> Properties();
+    
+    p.put(Context.INITIAL_CONTEXT_FACTORY, 
+          <SPAN class="code-quote">&quot;org.openejb.client.LocalInitialContextFactory&quot;</SPAN>);
+    
+    p.put(<SPAN class="code-quote">&quot;openejb.home&quot;</SPAN>, <SPAN class="code-quote">&quot;c:\\dir\\openejb&quot;</SPAN>);
+    
+    p.put(<SPAN class="code-quote">&quot;openejb.configuration&quot;</SPAN>, 
+          <SPAN class="code-quote">&quot;c:\\my\\app\\conf\\openejb.conf&quot;</SPAN>);
+    
+    InitialContext ctx = <SPAN class="code-keyword">new</SPAN> InitialContext( p );
+    
+    <SPAN class="code-object">Object</SPAN> obj = ctx.lookup(<SPAN class="code-quote">&quot;my/bean/Foo&quot;</SPAN>);
+    
+    FooHome ejbHome = (FooHome)
+        PortableRemoteObject.narrow(obj,FooHome.class);
+  
+  } <SPAN class="code-keyword">catch</SPAN> (Exception e){
+    e.printStackTRace();
+  }
+}
+}</PRE>
+</DIV></DIV>
+
+<P>Set the openejb.home variable</P>
+
+<P>If you use OpenEJB Local Server, you are actually using OpenEJB as an embedded library. This means when your application starts, OpenEJB will be starting too, in your virtual machine. Odds are you will not want to execute your application in the directory where OpenEJB was installed, but will want to execute your application where you are developing it. This is fine, but you will need to tell OpenEJB where it was installed. To do this, set the &quot;openejb.home&quot; system variable.</P>
+
+<P>For example, if OpenEJB was unpacked in the directory in c:\dir\openejb, you can set the openejb.home variable as a java vm flag as follows.</P>
+
+<BLOCKQUOTE><P>c:\my\app&gt; java -Dopenejb.home=c:\dir\openejb MyEjbApplication</P></BLOCKQUOTE>
+
+<P>You can also set the openejb.home variable by calling System.setProperty(...) in your application before any calls to the OpenEJB Local Server are made.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>MyEjbApplication.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java">...
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main(<SPAN class="code-object">String</SPAN> args[]) {
+    
+  <SPAN class="code-object">System</SPAN>.setProperty(<SPAN class="code-quote">&quot;openejb.home&quot;</SPAN>, <SPAN class="code-quote">&quot;c:\\dir\\openejb&quot;</SPAN>);
+  ...
+  
+}
+...</PRE>
+</DIV></DIV>
+
+<P>As mentioned above, you can pass OpenEJB parameters on your first call to the Local Server.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>MyEjbApplication.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java">...
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">static</SPAN> void main( <SPAN class="code-object">String</SPAN> args[]) {
+    
+  Properties p = <SPAN class="code-keyword">new</SPAN> Properties();
+  
+  p.put(Context.INITIAL_CONTEXT_FACTORY, 
+        <SPAN class="code-quote">&quot;org.openejb.client.LocalInitialContextFactory&quot;</SPAN>);
+  
+  p.put(<SPAN class="code-quote">&quot;openejb.home&quot;</SPAN>, <SPAN class="code-quote">&quot;c:\\dir\\openejb&quot;</SPAN>);
+      
+  InitialContext ctx = <SPAN class="code-keyword">new</SPAN> InitialContext( p );
+  ...
+}
+...</PRE>
+</DIV></DIV>
+
+<P>When OpenEJB is started, it will look for its configuration files in the OPENJB_HOME/conf directory. The paths to beans in your openejb.conf file are also resolved relative to the openejb.home variable.</P>
+
+<H1><A name="Embedding-Usingopenejb.conffiles"></A>Using openejb.conf files</H1>
+
+<P>Here is an example of this. The openejb.home variable, which we will refer to as OPENEJB_HOME, is set to &quot;c:\dir\openejb&quot;. The following relative path in your openejb.conf file will be resolved assuming OPENEJB_HOME as the base path.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
+...
+
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<P>The above deployment path, &quot;beans\&quot;, would automatically be expanded to &quot;c:\dir\openejb\beans&quot;.</P>
+
+<P>If you want tell OpenEJB to look outside the OPENEJB_HOME, then use an absolute file path as shown below.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
+...
+
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\app\my\beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
+</DIV></DIV>
+
+
+<P>OpenEJB can look in any number of directories for beans, just add those directories to your openejb.conf file as such.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
+...
+
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\app\my\beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\special\beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\foo\ejbs\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;d:\files\ejbjars\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<P>Furthermore, you can add jars individually to OpenEJB&apos;s deployment path by naming the jar directly.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>openejb.conf</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;openejb&gt;</SPAN>
+...
+
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\app\my\beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\my\special\beans\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;c:\foo\ejbs\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments dir=<SPAN class="code-quote">&quot;d:\files\ejbjars\&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;Deployments jar=<SPAN class="code-quote">&quot;c:\the\very\special.jar&quot;</SPAN> /&gt;</SPAN>
+<SPAN class="code-tag">&lt;/openejb&gt;</SPAN></PRE>
+</DIV></DIV>
+            </DIV>
+        </DIV>
+    </DIV>
+     </P>
+    </TD>
+<!--    <td width="120" height="5" valign="top" align="left"></td>   -->
+
+   </TR>
+   <TR height="5">
+    <TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
+    <TD width="95" height="5" bgcolor="#7270c2" valign="top">&nbsp;</TD>
+    <TD width="7" height="5" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
+    <TD width="40" height="5" valign="top" align="left">&nbsp;</TD>
+    <TD width="120" height="5" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR>
+    <TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
+    <TD width="95" bgcolor="#7270c2" valign="BOTTOM" align="left">&nbsp;</TD>
+    <TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
+    <TD width="120" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR>
+    <TD width="20" height="5" bgcolor="#7270c2" valign="top" align="left">&nbsp;</TD>
+    <TD width="95" bgcolor="#7270c2" valign="BOTTOM" align="left">&nbsp;</TD>
+    <TD width="7" bgcolor="#a9a5de" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
+    <TD width="40" valign="top" align="left"><IMG src="http://incubator.apache.org/openejb/images/dotTrans.gif" width="1" height="25" border="0"></TD>
+    <TD width="120" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR height="5">
+    <TD width="20" rowspan="2" height="100%" bgcolor="#7270c2" valign="bottom" align="left"><IMG src="http://incubator.apache.org/openejb/images/stripes1.gif" width="20" height="125" border="0"></TD>
+    <TD width="95" rowspan="2" height="100%" bgcolor="#7270c2" valign="bottom" align="left"><IMG src="http://incubator.apache.org/openejb/images/stripe105.gif" width="105" height="125" border="0"></TD>
+    <TD width="7" rowspan="2" height="100%" bgcolor="#a9a5de" valign="top" align="left">&nbsp;</TD>
+    <TD width="40" height="100%" valign="top" align="left">&nbsp;</TD>
+    <TD width="120" height="100%" valign="top" align="left">&nbsp;</TD>
+   </TR>
+   <TR height="5">
+    <TD width="40" height="25" valign="top" align="left">&nbsp;</TD>
+    <TD width="100%" height="25" valign="bottom" align="left"><BR>
+     <BR>
+     <IMG src="http://incubator.apache.org/openejb/images/line_light.gif" border="0" width="430" height="3"><BR>
+     <P>
+     </P>
+     <SPAN class="bodyGrey">
+     <SMALL><NOTICE><!-- $FOOTER -->
+Apache OpenEJB is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Geronimo PMC. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
+     </NOTICE> <BR>
+     &nbsp;<BR>
+          Powered by <A href="http://atlassian.com/">Atlassian</A> <A href="http://atlassian.com/confluence/">Confluence</A>.
+     </SMALL>
+     </SPAN>
+     <P>
+     </P>
+     </TD>
+    <TD width="120" height="25" valign="top" align="left">&nbsp;</TD>
+   </TR>
+  </TABLE>
+  </BODY>
+ </HTML>