📄 jmsj2eeex2.html
字号:
EJB</div></td> <td><a name="wp89791"> </a><div class="pCellBody">PublisherBean</div></td> <td><a name="wp89793"> </a><div class="pCellBody">PublisherBean</div></td></tr></table></div><p class="pBody"> </p><div align="left"><table border="1" summary="References Pane for ClientSessionMDBApp" id="wp92051"> <caption><a name="wp92051"> </a><div class="pTableTitle">Table 30-2 References Pane for ClientSessionMDBApp</div></caption> <tr align="center"> <th><a name="wp92067"> </a><div class="pCellHeading">Ref. Type</div></th> <th><a name="wp92069"> </a><div class="pCellHeading">Referenced By</div></th> <th><a name="wp92071"> </a><div class="pCellHeading">Reference Name</div></th> <th><a name="wp92073"> </a><div class="pCellHeading">JNDI Name</div></th></tr> <tr align="left"> <td><a name="wp92075"> </a><div class="pCellBody">EJB Ref</div></td> <td><a name="wp92077"> </a><div class="pCellBody">MyAppClient</div></td> <td><a name="wp92079"> </a><div class="pCellBody">ejb/remote/Publisher</div></td> <td><a name="wp92081"> </a><div class="pCellBody">Publisher</div></td></tr> <tr align="left"> <td><a name="wp92083"> </a><div class="pCellBody">Resource</div></td> <td><a name="wp92085"> </a><div class="pCellBody">PublisherBean</div></td> <td><a name="wp92087"> </a><div class="pCellBody">jms/MyConnectionFactory</div></td> <td><a name="wp92089"> </a><div class="pCellBody">jms/TopicConnectionFactory</div></td></tr></table></div><p class="pBody"></p><a name="wp89818"> </a><h3 class="pHeading2">Deploying the Application</h3><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp89819"> </a><div class="pSmartList1"><li>Choose File<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Save to save the application.</li></div><a name="wp89820"> </a><div class="pSmartList1"><li>Choose Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Deploy.</li></div><a name="wp89821"> </a><div class="pSmartList1"><li>In the dialog box, type your administrative user name and password (if they are not already filled in).</li></div><a name="wp93949"> </a><div class="pSmartList1"><li>In the Application Client Stub Directory area, select the Return Client Jar checkbox. If you wish to run the client in a directory other than the default, click Browse and use the file chooser to specify it.</li></div><a name="wp93911"> </a><div class="pSmartList1"><li>Click OK.</li></div><a name="wp89823"> </a><div class="pSmartList1"><li>In the Distribute Module dialog box, click Close when the process completes. You will find a file named <code class="cCode">ClientSessionMDBAppClient.jar</code> in the specified directory.</li></div></ol></div><a name="wp89825"> </a><h3 class="pHeading2">Running the Application Client</h3><a name="wp89829"> </a><p class="pBody">To run the client, use the following command:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">appclient -client ClientSessionMDBAppClient.jar<a name="wp89859"> </a></pre></div><a name="wp89860"> </a><p class="pBody">The program output in the terminal window looks something like this:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">Looking up EJB referenceLooked up homeNarrowed homeGot the EJB<a name="wp89869"> </a></pre></div><a name="wp83015"> </a><p class="pBody">The output from the enterprise beans appears in the server log (<code class="cCode"><</code><code class="cVariable">J2EE_HOME</code><code class="cCode">>/domains/domain1/logs/server.log</code>). The Publisher session bean sends two sets of 18 messages numbered 0 through 17. Because of the message selector, the message-driven bean receives only the messages whose <code class="cCode">NewsType</code> property is Sports or Opinion.</p><a name="wp89887"> </a><p class="pBody">Suppose that the last few messages from the Publisher session bean look like this: </p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">PUBLISHER: Setting message text to: Item 12: BusinessPUBLISHER: Setting message text to: Item 13: OpinionPUBLISHER: Setting message text to: Item 14: Living/ArtsPUBLISHER: Setting message text to: Item 15: SportsPUBLISHER: Setting message text to: Item 16: Living/ArtsPUBLISHER: Setting message text to: Item 17: Living/Arts<a name="wp83026"> </a></pre></div><a name="wp83080"> </a><p class="pBody">Because of the message selector, the last messages received by the message-driven bean will be the following:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">MESSAGE BEAN: Message received: Item 13: OpinionMESSAGE BEAN: Message received: Item 15: Sports<a name="wp83053"> </a></pre></div><a name="wp89890"> </a><p class="pBody">If you like, you can rewrite the message selector to receive different messages.</p> </blockquote> <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider"> <table width="550" summary="layout" id="SummaryNotReq1"> <tr> <td align="left" valign="center"> <font size="-1"> <a href="http://java.sun.com/j2ee/1.4/download.html#tutorial" target="_blank">Download</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/faq.html" target="_blank">FAQ</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/history.html" target="_blank">History</a> </td> <td align="center" valign="center"><a accesskey="p" href="JMSJ2EEex.html"><img id="LongDescNotReq1" src="images/PrevArrow.gif" width="26" height="26" border="0" alt="Prev" /></a><a accesskey="c" href="J2EETutorialFront.html"><img id="LongDescNotReq1" src="images/UpArrow.gif" width="26" height="26" border="0" alt="Home" /></a><a accesskey="n" href="JMSJ2EEex3.html"><img id="LongDescNotReq3" src="images/NextArrow.gif" width="26" height="26" border="0" alt="Next" /></a><a accesskey="i" href="J2EETutorialIX.html"></a> </td> <td align="right" valign="center"> <font size="-1"> <a href="http://java.sun.com/j2ee/1.4/docs/api/index.html" target="_blank">API</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/search.html" target="_blank">Search</a> <br> <a href="http://java.sun.com/j2ee/1.4/docs/tutorial/information/sendusmail.html" target="_blank">Feedback</a></font> </font> </td> </tr> </table> <img src="images/blueline.gif" width="550" height="8" ALIGN="BOTTOM" NATURALSIZEFLAG="3" ALT="Divider"><p><font size="-1">All of the material in <em>The J2EE(TM) 1.4 Tutorial</em> is <a href="J2EETutorialFront2.html">copyright</a>-protected and may not be published in other workswithout express written permission from Sun Microsystems.</font> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -