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 [11/29] - /incubator/openejb/trunk/website/html/

Added: incubator/openejb/trunk/website/html/hello-world.html
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/website/html/hello-world.html?view=auto&rev=450370
==============================================================================
--- incubator/openejb/trunk/website/html/hello-world.html (added)
+++ incubator/openejb/trunk/website/html/hello-world.html Wed Sep 27 00:53:16 2006
@@ -0,0 +1,594 @@
+
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<HTML>
+ <HEAD>
+  <!-- $PAGETITLE -->
+  <TITLE>OpenEJB - Hello World</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 -->
+	Hello World
+                </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=Hello%20World">[ 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=26494&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>A basic EJB example</P>
+
+<H1><A name="HelloWorld-Beforestarting"></A>Before starting</H1>
+
+<P>Windows</P>
+
+<P>C:\my\app&gt; RunIt</P>
+
+<P>Linux/Unix</P>
+
+<P><SPAN class="error">&#91;user@host app&#93;</SPAN># ./RunIt.sh<BR>
+What if it didn&apos;t work</P>
+
+<P>If you ran into any problems, first check your openejb.log file at c:\openejb\openejb.log. Look for any lines that begin with ** , ** , or ** .</P>
+
+<P>If the log file doesn&apos;t help you, email it to the OpenEJB user mailing list and let people know you are using the </P>
+
+<P>This example assumes you have already downloaded and installed OpenEJB in the directory c:\openejb. Refer to the <A href="quickstart.html" title="Quickstart">Quickstart</A> guide if you haven&apos;t yet installed OpenEJB.</P>
+
+<P>We also assume that you are running your client from the directory c:\my\app.</P>
+
+<H1><A name="HelloWorld-Theclassesandinterfaces"></A>The classes and interfaces</H1>
+
+<P>Create the package where we will place our ejb and application files, let&apos;s say &quot;c:\my\app&quot; for our example.</P>
+
+<P>Windows</P>
+<BLOCKQUOTE>
+<P>c:\my\app&gt; mkdir org<BR>
+c:\my\app&gt; mkdir org\acme</P></BLOCKQUOTE>
+
+<P>Linux/Unix</P>
+
+<BLOCKQUOTE>
+<P><SPAN class="error">&#91;user@host app&#93;</SPAN># mkdir org<BR>
+<SPAN class="error">&#91;user@host app&#93;</SPAN># mkdir org/acme</P></BLOCKQUOTE>
+
+<P>Create the files below in our new &quot;c:\my\app\org\acme\&quot; directory </P>
+
+<H2><A name="HelloWorld-Createthebeanclass"></A>Create the bean class</H2>
+
+<DIV class="code"><DIV class="codeHeader"><B>HelloBean.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.acme;
+
+<SPAN class="code-keyword">import</SPAN> java.rmi.RemoteException;
+<SPAN class="code-keyword">import</SPAN> javax.ejb.*;
+
+<SPAN class="code-keyword">public</SPAN> class HelloBean <SPAN class="code-keyword">implements</SPAN> SessionBean {
+  <SPAN class="code-keyword">private</SPAN> SessionContext sessionContext;
+  <SPAN class="code-keyword">public</SPAN> void ejbCreate() {
+  }
+  <SPAN class="code-keyword">public</SPAN> void ejbRemove() {
+  }
+  <SPAN class="code-keyword">public</SPAN> void ejbActivate() {
+  }
+  <SPAN class="code-keyword">public</SPAN> void ejbPassivate() {
+  }
+  <SPAN class="code-keyword">public</SPAN> void setSessionContext(SessionContext sessionContext) {
+    <SPAN class="code-keyword">this</SPAN>.sessionContext = sessionContext;
+  }
+  <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN> sayHello() <SPAN class="code-keyword">throws</SPAN> java.rmi.RemoteException {
+    <SPAN class="code-keyword">return</SPAN> <SPAN class="code-quote">&quot;Hello World!!!!!&quot;</SPAN>;
+  }
+}</PRE>
+</DIV></DIV>
+
+<H2><A name="HelloWorld-CreatetheEJBHomeinterface"></A>Create the EJB Home interface</H2>
+
+<DIV class="code"><DIV class="codeHeader"><B>HelloHome.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.acme;
+
+<SPAN class="code-keyword">import</SPAN> java.rmi.*;
+<SPAN class="code-keyword">import</SPAN> javax.ejb.*;
+<SPAN class="code-keyword">import</SPAN> java.util.*;
+
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> HelloHome <SPAN class="code-keyword">extends</SPAN> EJBHome {
+  <SPAN class="code-keyword">public</SPAN> HelloObject create() <SPAN class="code-keyword">throws</SPAN> RemoteException, CreateException;
+}</PRE>
+</DIV></DIV>
+
+<H2><A name="HelloWorld-CreatetheEJBObjectinterface"></A>Create the EJB Object interface</H2>
+
+<DIV class="code"><DIV class="codeHeader"><B>HelloObject.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.acme;
+
+<SPAN class="code-keyword">import</SPAN> java.rmi.*;
+<SPAN class="code-keyword">import</SPAN> javax.ejb.*;
+<SPAN class="code-keyword">import</SPAN> java.util.*;
+
+<SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> HelloObject <SPAN class="code-keyword">extends</SPAN> EJBObject {
+  <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN> sayHello() <SPAN class="code-keyword">throws</SPAN> RemoteException;
+}</PRE>
+</DIV></DIV>
+
+<H1><A name="HelloWorld-Thedeploymentdescriptor"></A>The deployment descriptor</H1>
+
+<P>The deployment descriptor tells the EJB Container how to put together the classes above and run your component. <BR>
+Fisrt, create a &quot;META-INF&quot; directory in the &quot;c:\my\app&quot; directory.</P>
+
+<P>Windows</P>
+<BLOCKQUOTE><P>c:\my\app&gt; mkdir META-INF</P></BLOCKQUOTE>
+
+<P>Linux/Unix</P>
+<BLOCKQUOTE><P><SPAN class="error">&#91;user@host app&#93;</SPAN># mkdir META-INF</P></BLOCKQUOTE>
+
+<P>Now, create an ejb-jar.xml file in your META-INF directory.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>ejb-jar.xml</B></DIV><DIV class="codeContent">
+<PRE class="code-xml"><SPAN class="code-tag">&lt;?xml version=<SPAN class="code-quote">&quot;1.0&quot;</SPAN> encoding=<SPAN class="code-quote">&quot;UTF-8&quot;</SPAN>?&gt;</SPAN>
+<SPAN class="code-tag">&lt;ejb-jar&gt;</SPAN>
+  <SPAN class="code-tag">&lt;enterprise-beans&gt;</SPAN>
+    <SPAN class="code-tag">&lt;session&gt;</SPAN>
+      <SPAN class="code-tag">&lt;ejb-name&gt;</SPAN>Hello<SPAN class="code-tag">&lt;/ejb-name&gt;</SPAN>
+      <SPAN class="code-tag">&lt;home&gt;</SPAN>org.acme.HelloHome<SPAN class="code-tag">&lt;/home&gt;</SPAN>
+      <SPAN class="code-tag">&lt;remote&gt;</SPAN>org.acme.HelloObject<SPAN class="code-tag">&lt;/remote&gt;</SPAN>
+      <SPAN class="code-tag">&lt;ejb-class&gt;</SPAN>org.acme.HelloBean<SPAN class="code-tag">&lt;/ejb-class&gt;</SPAN>
+      <SPAN class="code-tag">&lt;session-type&gt;</SPAN>Stateless<SPAN class="code-tag">&lt;/session-type&gt;</SPAN>
+      <SPAN class="code-tag">&lt;transaction-type&gt;</SPAN>Container<SPAN class="code-tag">&lt;/transaction-type&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/session&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/enterprise-beans&gt;</SPAN>
+  <SPAN class="code-tag">&lt;assembly-descriptor&gt;</SPAN>
+    <SPAN class="code-tag">&lt;container-transaction&gt;</SPAN>
+      <SPAN class="code-tag">&lt;method&gt;</SPAN>
+        <SPAN class="code-tag">&lt;ejb-name&gt;</SPAN>Hello<SPAN class="code-tag">&lt;/ejb-name&gt;</SPAN>
+        <SPAN class="code-tag">&lt;method-name&gt;</SPAN>*<SPAN class="code-tag">&lt;/method-name&gt;</SPAN>
+      <SPAN class="code-tag">&lt;/method&gt;</SPAN>
+      <SPAN class="code-tag">&lt;trans-attribute&gt;</SPAN>Required<SPAN class="code-tag">&lt;/trans-attribute&gt;</SPAN>
+    <SPAN class="code-tag">&lt;/container-transaction&gt;</SPAN>
+  <SPAN class="code-tag">&lt;/assembly-descriptor&gt;</SPAN>
+<SPAN class="code-tag">&lt;/ejb-jar&gt;</SPAN></PRE>
+</DIV></DIV>
+
+<H1><A name="HelloWorld-CompiletheEJB"></A>Compile the EJB</H1>
+
+<P>Compile your bean.</P>
+
+<P>Windows</P>
+<BLOCKQUOTE><P>c:\my\app&gt; javac org\acme&#42;.java</P></BLOCKQUOTE>
+
+<P>Linux/Unix</P>
+<BLOCKQUOTE><P><SPAN class="error">&#91;user@host app&#93;</SPAN># javac org/acme/*.java</P></BLOCKQUOTE>
+
+<P>Make sure you don&apos;t make the mistake of trying to compile your classes while sitting inside the org/acme/ directory.</P>
+
+<TABLE cellpadding="5" width="85%" cellspacing="8px" class="warningMacro" border="0" align="center"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>
+<P>To compile an EJB, you need to have EJB library in your classpath.<BR>
+One has been included for you in the directory lib/geronimo-ejb_2.1_spec-1.0.jar</P></TD></TR></TABLE>
+
+<H1><A name="HelloWorld-PackagetheEJB"></A>Package the EJB</H1>
+
+
+<P>Now, package your EJB classes and your META-INF directory into a jar.</P>
+
+<P>Windows</P>
+<BLOCKQUOTE><P>C:\my\app&gt; jar cvf myHelloEjb.jar org META-INF</P></BLOCKQUOTE>
+
+<P>Linux/Unix</P>
+<BLOCKQUOTE><P><SPAN class="error">&#91;user@host app&#93;</SPAN># jar cvf myHelloEjb.jar org META-INF</P></BLOCKQUOTE>
+
+<P>That command should give you output like the following.</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">added manifest
+adding: org/(in = 0) (out= 0)(stored 0%)
+adding: org/acme/(in = 0) (out= 0)(stored 0%)
+adding: org/acme/HelloBean.class(in = 946) (out= 467)(deflated 50%)
+adding: org/acme/HelloObject.class(in = 234) (out= 177)(deflated 24%)
+adding: org/acme/HelloHome.class(in = 263) (out= 188)(deflated 28%)
+ignoring entry META-INF/
+ignoring entry META-INF/MANIFEST.MF
+adding: META-INF/ejb-jar.xml(in = 733) (out= 319)(deflated 56%)</PRE>
+</DIV></DIV>
+
+<P>Check to make sure at least the three classes are there and the ejb-jar.xml is there and that everything is in the directories you see above.</P>
+
+<H1><A name="HelloWorld-DeploytheEJBjar"></A>Deploy the EJB jar</H1>
+
+<P>Use the OpenEJB <A href="deploy-tool.html" title="Deploy Tool">Deploy Tool</A> to deploy your jar.</P>
+
+<P>Windows</P>
+<BLOCKQUOTE><P>C:\my\app&gt; cd C:\openejb</P></BLOCKQUOTE>
+
+<BLOCKQUOTE><P>C:\openejb&gt; openejb.bat deploy -a -m c:\my\app\myHelloEjb.jar</P></BLOCKQUOTE>
+
+<P>Linux/Unix</P>
+<BLOCKQUOTE><P><SPAN class="error">&#91;user@host app&#93;</SPAN># cd /openejb</P></BLOCKQUOTE>
+
+<BLOCKQUOTE><P><SPAN class="error">&#91;user@host openejb&#93;</SPAN># ./openejb.sh deploy -a -m /my/app/myHelloEjb.jar</P></BLOCKQUOTE>
+
+<TABLE cellpadding="5" width="85%" cellspacing="8px" class="warningMacro" border="0" align="center"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>
+<P>Since the OpenEJB deployment tool writes to your jar file, make sure that no other programs are using it when you deploy (i.e. if you use an editor such as Forte for Java to create the jar file, that editor may still be using it). If you get an error such as &quot;Error in writing existing jar file&quot; close any programs that may be using the jar and try deploying again.</P></TD></TR></TABLE>
+
+<H1><A name="HelloWorld-Abasicclientapplication"></A>A basic client application</H1>
+
+<P>Create a basic client application to access your HelloWorld bean.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>HelloWorld.java</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.acme;
+
+<SPAN class="code-keyword">import</SPAN> javax.rmi.*;
+<SPAN class="code-keyword">import</SPAN> javax.naming.*;
+<SPAN class="code-keyword">import</SPAN> java.util.*;
+
+<SPAN class="code-keyword">public</SPAN> class HelloWorld {
+
+ <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(<SPAN class="code-quote">&quot;java.naming.factory.initial&quot;</SPAN>, <SPAN class="code-quote">&quot;org.openejb.client.RemoteInitialContextFactory&quot;</SPAN>);
+    p.put(<SPAN class="code-quote">&quot;java.naming.provider.url&quot;</SPAN>, <SPAN class="code-quote">&quot;127.0.0.1:4201&quot;</SPAN>);
+    p.put(<SPAN class="code-quote">&quot;java.naming.security.principal&quot;</SPAN>, <SPAN class="code-quote">&quot;myuser&quot;</SPAN>);
+    p.put(<SPAN class="code-quote">&quot;java.naming.security.credentials&quot;</SPAN>, <SPAN class="code-quote">&quot;mypass&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;/Hello&quot;</SPAN>);
+
+    HelloHome ejbHome = (HelloHome)
+    PortableRemoteObject.narrow(obj,HelloHome.class);
+    HelloObject ejbObject = ejbHome.create();
+
+    <SPAN class="code-object">String</SPAN> message = ejbObject.sayHello();
+    <SPAN class="code-object">System</SPAN>.out.println( message );
+  } <SPAN class="code-keyword">catch</SPAN> (Exception e){
+    e.printStackTrace();
+  }
+ }
+}</PRE>
+</DIV></DIV>
+
+<P>JNDI properties for the <A href="local-server.html" title="Local Server">Local Server</A> would look like the following. Be sure to read the Local Server documentation if you run into any problems.</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">Properties p = <SPAN class="code-keyword">new</SPAN> Properties();
+
+p.put(<SPAN class="code-quote">&quot;java.naming.factory.initial&quot;</SPAN>, 
+    <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:\\openejb&quot;</SPAN>);
+    
+InitialContext ctx = <SPAN class="code-keyword">new</SPAN> InitialContext(p);</PRE>
+</DIV></DIV>
+
+
+
+<P>JNDI properties for the <A href="remote-server.html" title="Remote Server">Remote Server</A> would look like the following. Be sure to start the Remote Server before running your application. See the Remote Server <A href="remote-server.html" title="Remote Server">documentation</A> for more information on using the Remote Server.</P>
+
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">Properties p = <SPAN class="code-keyword">new</SPAN> Properties();
+p.put(<SPAN class="code-quote">&quot;java.naming.factory.initial&quot;</SPAN>, <SPAN class="code-quote">&quot;org.openejb.client.RemoteInitialContextFactory&quot;</SPAN>);
+p.put(<SPAN class="code-quote">&quot;java.naming.provider.url&quot;</SPAN>, <SPAN class="code-quote">&quot;127.0.0.1:4201&quot;</SPAN>);
+p.put(<SPAN class="code-quote">&quot;java.naming.security.principal&quot;</SPAN>, <SPAN class="code-quote">&quot;myuser&quot;</SPAN>);
+p.put(<SPAN class="code-quote">&quot;java.naming.security.credentials&quot;</SPAN>, <SPAN class="code-quote">&quot;mypass&quot;</SPAN>);
+    
+InitialContext ctx = <SPAN class="code-keyword">new</SPAN> InitialContext(p);</PRE>
+</DIV></DIV>
+
+
+
+<P>Update the HelloWorld.java to contain the right JNDI properties.</P>
+
+<H1><A name="HelloWorld-Compiletheapplication"></A>Compile the application</H1>
+
+
+<P>Compile your client code. Don&apos;t forget to add your EJBs in the classpath!</P>
+
+<P>Windows</P>
+<BLOCKQUOTE><P>C:\my\app&gt; javac org\acme\HelloWorld.java</P></BLOCKQUOTE>
+
+<P>Linux/Unix</P>
+<BLOCKQUOTE><P><SPAN class="error">&#91;user@host app&#93;</SPAN># javac org/acme/HelloWorld.java</P></BLOCKQUOTE>
+
+<TABLE cellpadding="5" width="85%" cellspacing="8px" class="warningMacro" border="0" align="center"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>
+<P>To compile this application, you may need to have Sun&apos;s JNDI library in your classpath.<BR>
+One can be downloaded from <SPAN class="nobr"><A href="http://java.sun.com/products/jndi/" title="Visit page outside Confluence" rel="nofollow">http://java.sun.com/products/jndi/<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>.</P></TD></TR></TABLE>
+
+
+
+<H1><A name="HelloWorld-Runit%21"></A>Run it!</H1>
+
+<P>When you run OpenEJB in embedded server mode, you need all the server libraries in your classpath along with your beans and client code. Here is a simple script that will add those classes automactically. Feel free to use this script, or add it&apos;s contents to you own scripts.</P>
+
+<P>Example Windows Batch script.</P>
+<DIV class="code"><DIV class="codeHeader"><B>RunIt.bat</B></DIV><DIV class="codeContent">
+<PRE class="code-java">@echo off
+
+set OPENEJB_HOME=C:\openejb
+set PATH=%PATH%;%OPENEJB_HOME%\bin
+set JAVA=%JAVA_HOME%\bin\java
+
+set CP=
+<SPAN class="code-keyword">for</SPAN> %%i in (%OPENEJB_HOME%\lib\*.jar) <SPAN class="code-keyword">do</SPAN> call cp.bat %%i 
+<SPAN class="code-keyword">for</SPAN> %%i in (%OPENEJB_HOME%\dist\*.jar) <SPAN class="code-keyword">do</SPAN> call cp.bat %%i 
+<SPAN class="code-keyword">for</SPAN> %%i in (%OPENEJB_HOME%\beans\*.jar) <SPAN class="code-keyword">do</SPAN> call cp.bat %%i 
+set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%CP%
+
+%JAVA% %OPTIONS% -Dopenejb.home=%OPENEJB_HOME% org.acme.HelloWorld</PRE>
+</DIV></DIV>
+
+<P>Example Linux/Unix Batch script.</P>
+<DIV class="code"><DIV class="codeHeader"><B>RunIt.sh</B></DIV><DIV class="codeContent">
+<PRE class="code-java">#!/bin/sh
+
+# Set OPENEJB_HOME to the full path where you 
+# installed your OpenEJB distribution
+export OPENEJB_HOME=/openejb
+
+# Set JAVA_HOME to the full path where you 
+# installed your JDK distribution
+export JAVA_HOME=/usr/java/jdk1.3.1
+
+export PATH=${PATH}:${OPENEJB_HOME}/bin
+export JAVA=${JAVA_HOME}/bin/java
+
+export CP=
+CP=`echo $OPENEJB_HOME/lib/*.jar | tr &apos; &apos; &apos;:&apos;`:${CP}
+CP=`echo $OPENEJB_HOME/dist/*.jar | tr &apos; &apos; &apos;:&apos;`:${CP}
+CP=`echo $OPENEJB_HOME/beans/*.jar | tr &apos; &apos; &apos;:&apos;`:${CP}
+export CLASSPATH=$JAVA_HOME/lib/tools.jar:${CP}
+
+$JAVA -Dopenejb.home=$OPENEJB_HOME org.acme.HelloWorld</PRE>
+</DIV></DIV>
+
+<P>Now run the script!</P>
+
+<P>Windows</P>
+<BLOCKQUOTE><P>C:\my\app&gt; RunIt</P></BLOCKQUOTE>
+
+<P>Linux/Unix</P>
+<BLOCKQUOTE><P><SPAN class="error">&#91;user@host app&#93;</SPAN># ./RunIt.sh</P></BLOCKQUOTE>
+
+<H1><A name="HelloWorld-Whatifitdidn%27twork"></A>What if it didn&apos;t work</H1>
+
+<P>If you ran into any problems, first check your openejb.log file at c:\openejb\openejb.log. Look for any lines that begin with ** , ** , or ** .</P>
+
+<P>If the log file doesn&apos;t help you, email it to the OpenEJB <A href="mailing-lists.html" title="Mailing Lists">user mailing list</A> and let people know you are using the Hello World example.</P>
+            </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>