| |
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <HTML> |
| <HEAD> |
| <!-- $PAGETITLE --> |
| <TITLE>OpenEJB - Embedded and Remotable</TITLE> |
| <LINK href="http://openejb.apache.org/all.css" rel="stylesheet" type="text/css"> |
| <!--[if IE]><link rel="stylesheet" type="text/css" media="screen, projection" href="openejb.apache.org/ie.css"><![endif]--> |
| |
| <LINK rel="SHORTCUT ICON" href="http://openejb.apache.org/images/favicon.ico"> |
| <META http-equiv="Content-Type" content="text/html;charset=UTF-8"> |
| </HEAD> |
| <BODY> |
| |
| <!-- Delay the loading of the external javascript file needed for labels (as it takes too long to load and visibly holds loading of the page body) --> |
| <!-- To do this without javascript errors over undefined functions, we need to declare stubs here (that are overrided later by the proper implementations) --> |
| <SCRIPT language="JavaScript" type="text/javascript"> |
| function doAddLabel(hideTextfieldAfterAddParam) |
| { |
| // stub |
| } |
| |
| function onAddLabel() |
| { |
| // stub |
| } |
| |
| function showLabelsInput() |
| { |
| // stub |
| } |
| </SCRIPT> |
| |
| <A name="top"></A> |
| <TABLE class="frameTable" cellpadding="0" cellspacing="0" border="0"> |
| <TR class="Row1"> |
| <TD class="Col1"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col2"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col3"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col4"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col5"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| </TR> |
| <TR class="Row2"> |
| <TD class="Col1"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col2"> </TD> |
| <TD class="Col3" id="breadcrumbs"> |
| <!-- $TOP_NAV_BAR --> |
| <A href="../OPENEJB/index.html" title="Index">Home</A> | <A href="../OPENEJB/download.html" title="Download">Download</A> | <A href="../OPENEJB/mailing-lists.html" title="Mailing Lists">Lists</A> | <A href="http://issues.apache.org/jira/browse/OPENEJB" class="external-link" rel="nofollow">Issues</A> |
| |
| </TD> |
| <TD class="Col4"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col5"> </TD> |
| </TR> |
| <TR class="Row3"> |
| <TD class="Col1"><IMG alt="" class="Row3Img" id="thinLine" src="http://openejb.apache.org/images/line_sm.gif"></TD> |
| <TD class="Col2"><IMG alt="" class="Row3Img" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col3"><IMG alt="" class="Row3Img" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col4"><IMG alt="" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col5"><IMG alt="" class="Row3Img" src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| </TR> |
| <TR class="Row4"> |
| <TD class="Col1"> |
| <SPAN id="Navigation"> |
| |
| <H3><A name="Navigation-Overview"></A>Overview</H3> |
| |
| <UL class="alternate" type="square"> |
| <LI><A href="../OPENEJB/index.html" title="Index">Home</A></LI> |
| <LI><A href="../OPENEJB/news.html" title="News">News</A></LI> |
| <LI><A href="../OPENEJB/faq.html" title="FAQ">FAQ</A></LI> |
| <LI><A href="../OPENEJB/download.html" title="Download">Download</A></LI> |
| <LI><A href="index.html" title="Index">Documentation</A></LI> |
| <LI><A href="../OPENEJB/examples.html" title="Examples">Examples</A></LI> |
| <LI><A href="http://cwiki.apache.org/confluence/display/OPENEJB/Lightening%20Demos" class="external-link" rel="nofollow">Lightning Demos</A></LI> |
| <LI><A href="../OPENEJB/mailing-lists.html" title="Mailing Lists">Mailing Lists</A></LI> |
| <LI><A href="../OPENEJB/source-code.html" title="Source Code">Source Code</A></LI> |
| <LI><A href="http://blogs.apache.org/openejb" class="external-link" rel="nofollow">Project Blog</A></LI> |
| </UL> |
| |
| |
| <H3><A name="Navigation-Servers"></A>Servers</H3> |
| |
| <UL class="alternate" type="square"> |
| <LI><A href="../OPENEJB/local-server.html" title="Local Server">Local</A></LI> |
| <LI><A href="../OPENEJB/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="../OPENEJB/geronimo.html" title="Geronimo">Geronimo</A></LI> |
| <LI><A href="../OPENEJB/webobjects.html" title="WebObjects">WebObjects</A></LI> |
| </UL> |
| |
| |
| <H3><A name="Navigation-Community"></A>Community</H3> |
| |
| <UL class="alternate" type="square"> |
| <LI><A href="../OPENEJB/team.html" title="Team">Team</A></LI> |
| <LI><A href="../OPENEJB/articles.html" title="Articles">Articles</A></LI> |
| <LI><A href="http://webchat.freenode.net/?channels=openejb" class="external-link" rel="nofollow">IRC</A></LI> |
| </UL> |
| |
| |
| <H3><A name="Navigation-RelatedProjects"></A>Related Projects</H3> |
| |
| <UL class="alternate" type="square"> |
| <LI><A href="http://activemq.apache.org/" class="external-link" rel="nofollow">ActiveMQ</A></LI> |
| <LI><A href="http://openjpa.apache.org/" class="external-link" rel="nofollow">OpenJPA</A></LI> |
| <LI><A href="http://cxf.apache.org/" class="external-link" rel="nofollow">CXF</A></LI> |
| </UL> |
| |
| |
| <H3><A name="Navigation-Index"></A>Index</H3> |
| <UL class="alternate" type="square"> |
| <LI><A href="../OPENEJB/space-index.html" title="Space Index">Site Index</A></LI> |
| <LI><A href="space-index.html" title="Space Index">Doc Index</A></LI> |
| </UL> |
| |
| <H3> |
| <A name="Navigation-Feeds"></A> |
| Feeds |
| </H3> |
| |
| <UL class="feeds"> |
| <LI> |
| <A href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false"> |
| <IMG src="http://openejb.apache.org/images/rss.gif"></A> |
| <A class="feedsText" href="http://cwiki.apache.org/confluence/spaces/rss.action?key=OPENEJB&newPages=false">Site</A> |
| </LI> |
| |
| <LI><A href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB"> |
| <IMG src="http://openejb.apache.org/images/rss.gif"></A> |
| <A class="feedsText" href="http://cwiki.apache.org/confluence/spaces/blogrss.action?key=OPENEJB">News</A> |
| </LI> |
| </UL> |
| </SPAN> |
| </TD> |
| <TD class="Col2"> </TD> |
| <TD class="Col3"> |
| <TABLE id="PageHeader" border="0" width="100%"> |
| <TR> |
| <TD> |
| <A href="http://openejb.org/"> |
| <IMG hspace="0" src="http://openejb.apache.org/images/logo_openejb.gif" vspace="0"> |
| </A> |
| </TD> |
| <TD align="right"> |
| <A href="http://www.apache.org/"> |
| <IMG src="http://www.apache.org/images/asf-logo.gif" width="258" height="66"> |
| </A> |
| </TD> |
| </TR> |
| <TR> |
| <TD id="page_title"> |
| <!-- $TITLE --> |
| Embedded and Remotable |
| </TD> |
| |
| <TD align="right"> |
| <BR><BR> |
| <!-- Google CSE Search Box Begins --> |
| <FORM id="searchbox_010475492895890475512:_t4iqjrgx90" action="http://www.google.com/cse"> |
| <INPUT type="hidden" name="cx" value="010475492895890475512:_t4iqjrgx90"> |
| <INPUT type="hidden" name="cof" value="FORID:0"> |
| <INPUT name="q" type="text" size="25"> |
| <INPUT type="submit" name="sa" value="Search"> |
| </FORM> |
| <SCRIPT type="text/javascript" src="http://www.google.com/coop/cse/brand?form=searchbox_010475492895890475512:_t4iqjrgx90"></SCRIPT> |
| <!-- Google CSE Search Box Ends --> |
| |
| </TD> |
| </TR> |
| </TABLE> |
| <P> |
| <!-- $BODY --> |
| <DIV id="PageContent"> |
| <H1><A name="EmbeddedandRemotable-Overview"></A>Overview</H1> |
| |
| <P>This example shows how to use OpenEJB3's remoting capabilities in an embedded scenario. By remoting we mean that you wish to allow <B>clients in other vms</B> access your ejbs. <EM>Note, you do not need to go to this extreme to unit test ejbs with remote interfaces.</EM></P> |
| |
| <P>The basic recipe is the same for a standard embedded scenario but with these added ingreditents:</P> |
| |
| <UL> |
| <LI><B>openejb.embedded.remotable</B> property</LI> |
| <LI><B>openejb-ejbd</B> jar</LI> |
| </UL> |
| |
| |
| <P>While creating the InitialContext, pass in the openejb.embedded.remotable property with the value of "true". When this is seen by the LocalInitialContextFactory, it will boot up the Server ServiceManager in the VM which will in turn look for ServerServices in the classpath.</P> |
| |
| <P>Provided you have the openejb-ejbd jar in your classpath along with it's dependencies (openejb-server, openejb-client, openejb-core), then those services will be brought online and remote clients will be able to connect into your vm and invoke beans.</P> |
| |
| <P>If you want to add more ServerServices such as the http version of the ejbd protocol you'd simply add the openejb-httpejbd jar to your classpath. A number of ServerServices are available currently:</P> |
| |
| <UL> |
| <LI>openejb-ejbd</LI> |
| <LI>openejb-http</LI> |
| <LI>openejb-telnet</LI> |
| <LI>openejb-derbynet</LI> |
| <LI>openejb-hsql</LI> |
| <LI>openejb-activemq</LI> |
| </UL> |
| |
| |
| <P><EM>The source for this example is in the "telephone-stateful" directory located in the <A href="../OPENEJB/download.html" title="Download">openejb-examples.zip</A> available on the download page.</EM></P> |
| |
| <DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>If your goal is simply to unit test beans with remote interfaces, this is <B>not</B> the right example for you. The LocalInitialContextFactory completely supports remote interfaces and all spec required pass-by-value (serialization) semantics without the need for network sockets. This example shows the use of OpenEJB in an embedded environment where connection <B>outside</B> the <BR> |
| vm is required.</TD></TR></TABLE></DIV> |
| |
| <H1><A name="EmbeddedandRemotable-TheCode"></A>The Code</H1> |
| |
| <P>For this example we have a simple Stateful bean called TelephoneBean as defined below. As a simple way of demonstrating the state we have to methods: speak and listen. You call <EM>speak</EM> and pass in some text, then you call <EM>listen</EM> to get your answer.</P> |
| |
| <H2><A name="EmbeddedandRemotable-bean"></A>bean</H2> |
| |
| <DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent"> |
| <PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.superbiz.telephone; |
| |
| <SPAN class="code-keyword">import</SPAN> javax.ejb.Remote; |
| <SPAN class="code-keyword">import</SPAN> javax.ejb.Stateful; |
| <SPAN class="code-keyword">import</SPAN> java.util.ArrayList; |
| <SPAN class="code-keyword">import</SPAN> java.util.List; |
| |
| @Remote |
| @Stateful |
| <SPAN class="code-keyword">public</SPAN> class TelephoneBean <SPAN class="code-keyword">implements</SPAN> Telephone { |
| |
| <SPAN class="code-keyword">private</SPAN> <SPAN class="code-keyword">static</SPAN> <SPAN class="code-keyword">final</SPAN> <SPAN class="code-object">String</SPAN>[] answers = { |
| <SPAN class="code-quote">"How nice."</SPAN>, |
| <SPAN class="code-quote">"Oh, of course."</SPAN>, |
| <SPAN class="code-quote">"Interesting."</SPAN>, |
| <SPAN class="code-quote">"Really?"</SPAN>, |
| <SPAN class="code-quote">"No."</SPAN>, |
| <SPAN class="code-quote">"Definitely."</SPAN>, |
| <SPAN class="code-quote">"I wondered about that."</SPAN>, |
| <SPAN class="code-quote">"Good idea."</SPAN>, |
| <SPAN class="code-quote">"You don't say!"</SPAN>, |
| }; |
| |
| <SPAN class="code-keyword">private</SPAN> List<<SPAN class="code-object">String</SPAN>> conversation = <SPAN class="code-keyword">new</SPAN> ArrayList<<SPAN class="code-object">String</SPAN>>(); |
| |
| <SPAN class="code-keyword">public</SPAN> void speak(<SPAN class="code-object">String</SPAN> words) { |
| conversation.add(words); |
| } |
| |
| <SPAN class="code-keyword">public</SPAN> <SPAN class="code-object">String</SPAN> listen() { |
| <SPAN class="code-keyword">if</SPAN> (conversation.size() == 0) { |
| <SPAN class="code-keyword">return</SPAN> <SPAN class="code-quote">"Nothing has been said"</SPAN>; |
| } |
| |
| <SPAN class="code-object">String</SPAN> lastThingSaid = conversation.get(conversation.size() - 1); |
| <SPAN class="code-keyword">return</SPAN> answers[<SPAN class="code-object">Math</SPAN>.abs(lastThingSaid.hashCode()) % answers.length]; |
| } |
| } |
| </PRE> |
| </DIV></DIV> |
| |
| <H2><A name="EmbeddedandRemotable-businessinterface"></A>business interface</H2> |
| |
| <DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent"> |
| <PRE class="code-java"><SPAN class="code-keyword">package</SPAN> org.superbiz.telephone; |
| |
| <SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> Telephone { |
| |
| void speak(<SPAN class="code-object">String</SPAN> words); |
| |
| <SPAN class="code-object">String</SPAN> listen(); |
| } |
| </PRE> |
| </DIV></DIV> |
| |
| <DIV class="panelMacro"><TABLE class="tipMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>EJB3 Notes</B><BR>The bean class uses the annotation <B>@Remote</B> but does not specify a list of interfaces as is normally required. Per EJB3 rules, if the bean implements exactly <B>one business interface</B> it may use @Remote with no other values and that business interface is then implied to be a remote business interface. The same rule applies to identical usage of @Local. |
| |
| <P>The critical thing to know is that if you add another interface the rules change and require that you specify both interfaces in the @Remote annotation as in @Remote({Telephone.class, SecondInterface.class}).</P></TD></TR></TABLE></DIV> |
| |
| <H1><A name="EmbeddedandRemotable-Embedding"></A>Embedding</H1> |
| |
| <P>We're going to embed OpenEJB3 into a plain JUnit TestCase as a simple means of demonstrating the remote capabilities. We'll do the embedding in our test setUp method, then will make two test methods: </P> |
| <UL class="alternate" type="square"> |
| <LI>one for invoking the bean's remote interface via the <B>LocalInitialContextFactory</B> which goes straight against the embedded container system</LI> |
| <LI>one for invoking the bean's remote interface via the <B>RemoteInitialContextFactory</B> which connects to a Socket and communicates to the embedded container system over the ejbd protocol.</LI> |
| </UL> |
| |
| |
| <H2><A name="EmbeddedandRemotable-setUp"></A>setUp</H2> |
| |
| <DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent"> |
| <PRE class="code-java"><SPAN class="code-keyword">protected</SPAN> void setUp() <SPAN class="code-keyword">throws</SPAN> Exception { |
| Properties properties = <SPAN class="code-keyword">new</SPAN> Properties(); |
| properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, <SPAN class="code-quote">"org.apache.openejb.client.LocalInitialContextFactory"</SPAN>); |
| properties.setProperty(<SPAN class="code-quote">"openejb.embedded.remotable"</SPAN>, <SPAN class="code-quote">"<SPAN class="code-keyword">true</SPAN>"</SPAN>); |
| <SPAN class="code-comment">// Uncomment these properties to change the defaults |
| </SPAN> <SPAN class="code-comment">//properties.setProperty(<SPAN class="code-quote">"ejbd.port"</SPAN>, <SPAN class="code-quote">"4202"</SPAN>); |
| </SPAN> <SPAN class="code-comment">//properties.setProperty(<SPAN class="code-quote">"ejbd.bind"</SPAN>, <SPAN class="code-quote">"localhost"</SPAN>); |
| </SPAN> <SPAN class="code-comment">//properties.setProperty(<SPAN class="code-quote">"ejbd.threads"</SPAN>, <SPAN class="code-quote">"200"</SPAN>); |
| </SPAN> <SPAN class="code-comment">//properties.setProperty(<SPAN class="code-quote">"ejbd.disabled"</SPAN>, <SPAN class="code-quote">"<SPAN class="code-keyword">false</SPAN>"</SPAN>); |
| </SPAN> <SPAN class="code-comment">//properties.setProperty(<SPAN class="code-quote">"ejbd.only_from"</SPAN>, <SPAN class="code-quote">"127.0.0.1,192.168.1.1"</SPAN>); |
| </SPAN> |
| <SPAN class="code-keyword">new</SPAN> InitialContext(properties); |
| } |
| </PRE> |
| </DIV></DIV> |
| |
| <H2><A name="EmbeddedandRemotable-LocalInitialContextFactory%3Amakinginvmcallstoaremotebusinessinterface"></A>LocalInitialContextFactory: making in-vm calls to a remote business interface</H2> |
| |
| <DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent"> |
| <PRE class="code-java"><SPAN class="code-keyword">public</SPAN> void testTalkOverLocalNetwork() <SPAN class="code-keyword">throws</SPAN> Exception { |
| |
| Properties properties = <SPAN class="code-keyword">new</SPAN> Properties(); |
| properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, <SPAN class="code-quote">"org.apache.openejb.client.LocalInitialContextFactory"</SPAN>); |
| InitialContext localContext = <SPAN class="code-keyword">new</SPAN> InitialContext(properties); |
| |
| Telephone telephone = (Telephone) localContext.lookup(<SPAN class="code-quote">"TelephoneBeanRemote"</SPAN>); |
| |
| telephone.speak(<SPAN class="code-quote">"Did you know I am talking directly through the embedded container?"</SPAN>); |
| |
| assertEquals(<SPAN class="code-quote">"Interesting."</SPAN>, telephone.listen()); |
| |
| |
| telephone.speak(<SPAN class="code-quote">"Yep, I'm using the bean's remote <SPAN class="code-keyword">interface</SPAN> but since the ejb container is embedded "</SPAN> + |
| <SPAN class="code-quote">"in the same vm I'm just using the LocalInitialContextFactory."</SPAN>); |
| |
| assertEquals(<SPAN class="code-quote">"Really?"</SPAN>, telephone.listen()); |
| |
| |
| telephone.speak(<SPAN class="code-quote">"Right, you really only have to use the RemoteInitialContextFactory <SPAN class="code-keyword">if</SPAN> you're in a different vm."</SPAN>); |
| |
| assertEquals(<SPAN class="code-quote">"Oh, of course."</SPAN>, telephone.listen()); |
| } |
| </PRE> |
| </DIV></DIV> |
| |
| <H2><A name="EmbeddedandRemotable-RemoteInitialContextFactory%3Amakingnetworkedcallstoaremotebusinessinterface"></A>RemoteInitialContextFactory: making networked calls to a remote business interface</H2> |
| |
| <P>This is the part you would want to do in apps that are running a different VM than the one in which the ejb container is embedded. These "client" VMs need only have the the <B>openejb-client jar</B> in their classpath and connect to OpenEJB via the RemoteInitialContextFactory like any other remote EJB client.</P> |
| |
| <DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent"> |
| <PRE class="code-java"><SPAN class="code-keyword">public</SPAN> void testTalkOverRemoteNetwork() <SPAN class="code-keyword">throws</SPAN> Exception { |
| Properties properties = <SPAN class="code-keyword">new</SPAN> Properties(); |
| properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, <SPAN class="code-quote">"org.apache.openejb.client.RemoteInitialContextFactory"</SPAN>); |
| properties.setProperty(Context.PROVIDER_URL, <SPAN class="code-quote">"ejbd:<SPAN class="code-comment">//localhost:4201"</SPAN>); |
| </SPAN> InitialContext remoteContext = <SPAN class="code-keyword">new</SPAN> InitialContext(properties); |
| |
| Telephone telephone = (Telephone) remoteContext.lookup(<SPAN class="code-quote">"TelephoneBeanRemote"</SPAN>); |
| |
| telephone.speak(<SPAN class="code-quote">"Is <SPAN class="code-keyword">this</SPAN> a local call?"</SPAN>); |
| |
| assertEquals(<SPAN class="code-quote">"No."</SPAN>, telephone.listen()); |
| |
| |
| telephone.speak(<SPAN class="code-quote">"This would be a lot cooler <SPAN class="code-keyword">if</SPAN> I was connecting from another VM then, huh?"</SPAN>); |
| |
| assertEquals(<SPAN class="code-quote">"I wondered about that."</SPAN>, telephone.listen()); |
| |
| |
| telephone.speak(<SPAN class="code-quote">"I suppose I should hangup and call back over the LocalInitialContextFactory."</SPAN>); |
| |
| assertEquals(<SPAN class="code-quote">"Good idea."</SPAN>, telephone.listen()); |
| |
| |
| telephone.speak(<SPAN class="code-quote">"I'll remember <SPAN class="code-keyword">this</SPAN> though in <SPAN class="code-keyword">case</SPAN> I ever have to call you accross a network."</SPAN>); |
| |
| assertEquals(<SPAN class="code-quote">"Definitely."</SPAN>, telephone.listen()); |
| } |
| </PRE> |
| </DIV></DIV> |
| |
| <H1><A name="EmbeddedandRemotable-Mavensetup"></A>Maven setup</H1> |
| |
| <P>Nice thing about maven2 is it has test-only dependencies. |
| This guarantees that non of your runtime code is dependent |
| on any OpenEJB classes.</P> |
| |
| <P>You need this dep or no clients will be able to connect |
| over the ejbd protocol to the embedded ejb container.</P> |
| |
| <P>Notice the other examples use 'openejb-core' and this one |
| uses 'openejb-ejbd'. If you wanted to make more protocols |
| available, you simply have to add deps to them and they'll |
| get picked up in the classpath automatically.</P> |
| |
| <DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent"> |
| <PRE class="code-xml"><SPAN class="code-tag"><dependency></SPAN> |
| <SPAN class="code-tag"><groupId></SPAN>org.apache.openejb<SPAN class="code-tag"></groupId></SPAN> |
| <SPAN class="code-tag"><artifactId></SPAN>openejb-ejbd<SPAN class="code-tag"></artifactId></SPAN> |
| <SPAN class="code-tag"><version></SPAN>3.1.4<SPAN class="code-tag"></version></SPAN> |
| <SPAN class="code-tag"><scope></SPAN>test<SPAN class="code-tag"></scope></SPAN> |
| <SPAN class="code-tag"></dependency></SPAN> |
| </PRE> |
| </DIV></DIV> |
| |
| |
| <H1><A name="EmbeddedandRemotable-Running"></A>Running</H1> |
| |
| <P>Running the example is fairly simple. In the "telephone-stateful" directory of the <A href="../OPENEJB/download.html" title="Download">examples zip</A>, just run:</P> |
| |
| <P>$ mvn clean install</P> |
| |
| <P>Which should create output like the following.</P> |
| |
| <DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent"> |
| <PRE>------------------------------------------------------- |
| T E S T S |
| ------------------------------------------------------- |
| Running org.superbiz.telephone.TelephoneTest |
| Apache OpenEJB 3.0 build: 20080408-04:13 |
| http://openejb.apache.org/ |
| INFO - openejb.home = /Users/dblevins/work/openejb-3.0/examples/telephone-stateful |
| INFO - openejb.base = /Users/dblevins/work/openejb-3.0/examples/telephone-stateful |
| INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service) |
| INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager) |
| INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory, type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory) |
| INFO - Found EjbModule in classpath: /Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes |
| INFO - Configuring app: /Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes |
| INFO - Configuring Service(id=Default Stateful Container, type=Container, provider-id=Default Stateful Container) |
| INFO - Auto-creating a container for bean TelephoneBean: Container(type=STATEFUL, id=Default Stateful Container) |
| INFO - Loaded Module: /Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes |
| INFO - Assembling app: /Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes |
| INFO - Jndi(name=TelephoneBeanRemote) --> Ejb(deployment-id=TelephoneBean) |
| INFO - Created Ejb(deployment-id=TelephoneBean, ejb-name=TelephoneBean, container=Default Stateful Container) |
| INFO - Deployed Application(path=/Users/dblevins/work/openejb-3.0/examples/telephone-stateful/target/classes) |
| ** Starting Services ** |
| NAME IP PORT |
| ejbd 127.0.0.1 4201 |
| admin thread 127.0.0.1 4200 |
| ------- |
| Ready! |
| Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.89 sec |
| |
| Results : |
| |
| Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 |
| </PRE> |
| </DIV></DIV> |
| |
| </DIV> |
| </P> |
| </TD> |
| <TD class="Col4"><IMG src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col5"> |
| |
| |
| </TD> |
| </TR> |
| <TR class="Row5"> |
| <TD class="Col1"> </TD> |
| <TD class="Col2"> </TD> |
| <TD class="Col3"> |
| <BR> |
| <BR> |
| <IMG width="100%" height="1" src="http://openejb.apache.org/images/line_light.gif"> |
| <TABLE width="100%"> |
| <TR> |
| <TD> |
| <SPAN class="bodyGrey"> |
| <SMALL> |
| <NOTICE><!-- $FOOTER --> |
| Apache OpenEJB is an project of The Apache Software Foundation (ASF) |
| </NOTICE> |
| <BR> |
| Site Powered by |
| <A href="http://atlassian.com/">Atlassian</A> |
| <A href="http://atlassian.com/confluence/">Confluence</A> |
| . |
| </SMALL> |
| </SPAN> |
| </TD> |
| <TD align="right"> |
| <A style="color:#999;font-size:small;font-weight:normal;" href="https://cwiki.apache.org/confluence/pages/editpage.action?spaceKey=OPENEJBx30&title=Embedded%20and%20Remotable">[ edit ]</A> |
| </TD> |
| </TR> |
| </TABLE> |
| <BR> |
| </TD> |
| <TD class="Col4"><IMG src="http://openejb.apache.org/images/dotTrans.gif"></TD> |
| <TD class="Col5"> </TD> |
| </TR> |
| </TABLE> |
| |
| <!-- Needed for composition plugin --> |
| <!-- delay the loading of large javascript files to the end so that they don't interfere with the loading of page content --> |
| <SPAN style="display: none"> |
| <SCRIPT type="text/javascript" language="JavaScript" src="http://cwiki.apache.org/confluence/labels-javascript"></SCRIPT> |
| |
| <SCRIPT src="http://www.google-analytics.com/urchin.js" type="text/javascript"> |
| </SCRIPT> |
| <SCRIPT type="text/javascript"> |
| _uacct = "UA-2717626-1"; |
| urchinTracker(); |
| </SCRIPT> |
| </SPAN> |
| |
| </BODY> |
| </HTML> |