⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmsj2eeex5.html

📁 j2eePDF格式的电子书
💻 HTML
📖 第 1 页 / 共 2 页
字号:
</div></th>    <th><a name="wp92544"> </a><div class="pCellHeading">JNDI Name</div></th></tr>  <tr align="left">    <td><a name="wp88480"> </a><div class="pCellBody">Resource</div></td>    <td><a name="wp88482"> </a><div class="pCellBody">ReplyMsgBean</div></td>    <td><a name="wp88484"> </a><div class="pCellBody">jms/MyConnectionFactory</div></td>    <td><a name="wp88486"> </a><div class="pCellBody">jms/TopicConnectionFactory</div></td></tr></table></div><p class="pBody"></p><a name="wp88457"> </a><p class="pBody">Select the <code class="cCode">MultiClientApp</code> application and click the JNDI Names tab.</p><a name="wp88316"> </a><p class="pBody">The JNDI names for the application should appear as shown in <a  href="JMSJ2EEex5.html#wp88321">Table 30-9</a>. Only the References Pane has any content.</p><div align="left"><table border="1" summary="References Pane for MultiClientApp" id="wp88321">  <caption><a name="wp88321"> </a><div class="pTableTitle">Table 30-9   References Pane for MultiClientApp</div></caption>  <tr align="center">    <th><a name="wp92598"> </a><div class="pCellHeading">Ref. Type</div></th>    <th><a name="wp92600"> </a><div class="pCellHeading">Referenced By</div></th>    <th><a name="wp92602"> </a><div class="pCellHeading">Reference Name</div></th>    <th><a name="wp92604"> </a><div class="pCellHeading">JNDI Name</div></th></tr>  <tr align="left">    <td><a name="wp88337"> </a><div class="pCellBody">Resource</div></td>    <td><a name="wp88339"> </a><div class="pCellBody">MultiAppServerClient</div></td>    <td><a name="wp88341"> </a><div class="pCellBody">jms/ConnectionFactory1</div></td>    <td><a name="wp88343"> </a><div class="pCellBody">jms/TopicConnectionFactory</div></td></tr>  <tr align="left">    <td><a name="wp88507"> </a><div class="pCellBody">Resource</div></td>    <td><a name="wp88509"> </a><div class="pCellBody">MultiAppServerClient</div></td>    <td><a name="wp88511"> </a><div class="pCellBody">jms/ConnectionFactory2</div></td>    <td><a name="wp88513"> </a><div class="pCellBody">jms/EarthQueueConnectionFactory</div></td></tr></table></div><p class="pBody"></p><a name="wp88520"> </a><h3 class="pHeading2">Deploying the Applications</h3><a name="wp88521"> </a><p class="pBody">To deploy the <code class="cCode">MultiClientApp</code> application and the <code class="cCode">ReplyBeanApp</code> application on the local server, perform the following steps for each application:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp95198"> </a><div class="pSmartList1"><li>Save the application.</li></div><a name="wp88523"> </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="wp88524"> </a><div class="pSmartList1"><li>In the dialog box, choose the URI for <code class="cCode">localhost</code> from the menu:</li></div><a name="wp88525"> </a><p class="pBodyRelative"><code class="cCode">localhost:4848</code></p><a name="wp88526"> </a><div class="pSmartList1"><li>Type your administrative user name and password (if they are not already filled in).</li></div><a name="wp93992"> </a><div class="pSmartList1"><li>For the <code class="cCode">MultiClientApp</code> application, select the Return Client Jar checkbox in the Application Client Stub Directory area. 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="wp93993"> </a><div class="pSmartList1"><li>Click OK.</li></div><a name="wp88528"> </a><div class="pSmartList1"><li>In the Distribute Module dialog box, click Close when the process completes. For the <code class="cCode">MultiClientApp</code> application, you will find a file named <code class="cCode">MultiClientAppClient.jar</code> in the specified directory.</li></div></ol></div><a name="wp88529"> </a><p class="pBody">Before you can deploy the <code class="cCode">ReplyBeanApp</code> application on the remote server, you must add the remote server. If you did not do so before, perform the following steps:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp88530"> </a><div class="pSmartList1"><li>Choose File<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Add Server.</li></div><a name="wp88531"> </a><div class="pSmartList1"><li>Type the name of the server in the Server Name field and click OK.</li></div><a name="wp88532"> </a><div class="pSmartList1"><li>The server appears in the tree under Servers. Select it.</li></div><a name="wp88533"> </a><div class="pSmartList1"><li>In the dialog box that appears, type the administrative user name and password for the server in the Connection Settings area and click OK.</li></div></ol></div><a name="wp88534"> </a><p class="pBody">To deploy the <code class="cCode">ReplyBeanApp</code> application on the remote server, perform the following steps:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp88535"> </a><div class="pSmartList1"><li>Save the application.</li></div><a name="wp88536"> </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="wp88537"> </a><div class="pSmartList1"><li>In the dialog box, choose the URI with the name of the remote system from the menu.</li></div><a name="wp88538"> </a><div class="pSmartList1"><li>Type your administrative user name and password (if they are not already filled in) and click OK.</li></div><a name="wp88540"> </a><div class="pSmartList1"><li>In the Distribute Module dialog box, click Close when the process completes.</li></div></ol></div><a name="wp88567"> </a><h3 class="pHeading2">Running the Application Client</h3><a name="wp88572"> </a><p class="pBody">To run the client, use the following command:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">appclient -client MultiClientAppClient.jar<a name="wp88573"> </a></pre></div><a name="wp84004"> </a><p class="pBody">On the local system, the output of the <code class="cCode">appclient</code> command looks something like this:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">Binding name:`java:comp/env/jms/TopicName`Sent message: text: id=1 to local app serverSent message: text: id=2 to remote app serverReplyListener: Received message: id=1, text=ReplyMsgBean processed message: text: id=1 to local app serverSent message: text: id=3 to local app serverReplyListener: Received message: id=3, text=ReplyMsgBean processed message: text: id=3 to local app serverReplyListener: Received message: id=2, text=ReplyMsgBean processed message: text: id=2 to remote app serverSent message: text: id=4 to remote app serverReplyListener: Received message: id=4, text=ReplyMsgBean processed message: text: id=4 to remote app serverSent message: text: id=5 to local app serverReplyListener: Received message: id=5, text=ReplyMsgBean processed message: text: id=5 to local app serverSent message: text: id=6 to remote app serverReplyListener: Received message: id=6, text=ReplyMsgBean processed message: text: id=6 to remote app serverSent message: text: id=7 to local app serverReplyListener: Received message: id=7, text=ReplyMsgBean processed message: text: id=7 to local app serverSent message: text: id=8 to remote app serverReplyListener: Received message: id=8, text=ReplyMsgBean processed message: text: id=8 to remote app serverSent message: text: id=9 to local app serverReplyListener: Received message: id=9, text=ReplyMsgBean processed message: text: id=9 to local app serverSent message: text: id=10 to remote app serverReplyListener: Received message: id=10, text=ReplyMsgBean processed message: text: id=10 to remote app serverWaiting for 0 message(s) from local app serverWaiting for 0 message(s) from remote app serverFinishedClosing connection 1Closing connection 2<a name="wp84017"> </a></pre></div><a name="wp84113"> </a><p class="pBody">On the local system, where the message-driven bean receives the odd-numbered messages, the output in the server log looks like this:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">In ReplyMsgBean.ReplyMsgBean()In ReplyMsgBean.setMessageDrivenContext()In ReplyMsgBean.ejbCreate()ReplyMsgBean: Received message: text: id=1 to local app serverReplyMsgBean: Received message: text: id=3 to local app serverReplyMsgBean: Received message: text: id=5 to local app serverReplyMsgBean: Received message: text: id=7 to local app serverReplyMsgBean: Received message: text: id=9 to local app server<a name="wp84116"> </a></pre></div><a name="wp84178"> </a><p class="pBody">On the remote system, where the bean receives the even-numbered messages, the output in the server log looks like this:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">In ReplyMsgBean.ReplyMsgBean()In ReplyMsgBean.setMessageDrivenContext()In ReplyMsgBean.ejbCreate()ReplyMsgBean: Received message: text: id=2 to remote app serverReplyMsgBean: Received message: text: id=4 to remote app serverReplyMsgBean: Received message: text: id=6 to remote app serverReplyMsgBean: Received message: text: id=8 to remote app serverReplyMsgBean: Received message: text: id=10 to remote app server<a name="wp84181"> </a></pre></div><a name="wp78307"> </a><p class="pBody"></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="JMSJ2EEex4.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="CB.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 + -