📄 jmsj2eeex4.html
字号:
</div></th> <th><a name="wp92471"> </a><div class="pCellHeading">Component</div></th> <th><a name="wp92473"> </a><div class="pCellHeading">JNDI Name</div></th></tr> <tr align="left"> <td><a name="wp92475"> </a><div class="pCellBody">EJB</div></td> <td><a name="wp92477"> </a><div class="pCellBody">MessageBean</div></td> <td><a name="wp92479"> </a><div class="pCellBody">jms/Queue</div></td></tr></table></div><p class="pBody"></p><a name="wp87472"> </a><p class="pBody">The JNDI name for the <code class="cCode">EarthClientApp</code> application should appear as shown in <a href="JMSJ2EEex4.html#wp87650">Table 30-6</a>. Only the References Pane has any content.</p><div align="left"><table border="1" summary="References Pane for LocalClientApp" id="wp87650"> <caption><a name="wp87650"> </a><div class="pTableTitle">Table 30-6 References Pane for EarthClientApp</div></caption> <tr align="center"> <th><a name="wp92517"> </a><div class="pCellHeading">Ref. Type</div></th> <th><a name="wp92519"> </a><div class="pCellHeading">Referenced By</div></th> <th><a name="wp92521"> </a><div class="pCellHeading">Reference Name</div></th> <th><a name="wp92523"> </a><div class="pCellHeading">JNDI Name</div></th></tr> <tr align="left"> <td><a name="wp87666"> </a><div class="pCellBody">Resource</div></td> <td><a name="wp87668"> </a><div class="pCellBody">SimpleClient</div></td> <td><a name="wp87670"> </a><div class="pCellBody">jms/MyConnectionFactory</div></td> <td><a name="wp87672"> </a><div class="pCellBody">jms/QueueConnectionFactory</div></td></tr></table></div><p class="pBody"></p><a name="wp87874"> </a><h3 class="pHeading2">Deploying the Applications</h3><a name="wp91039"> </a><p class="pBody">Before you can deploy the applications, you must add the remote server. On <code class="cCode">mars</code>, perform the following steps:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp91040"> </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="wp91041"> </a><div class="pSmartList1"><li>Type the name of the remote system in the Server Name field and click OK.</li></div><a name="wp91042"> </a><div class="pSmartList1"><li>The server appears in the tree under Servers. Select it.</li></div><a name="wp91043"> </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="wp87747"> </a><p class="pBody">To deploy the <code class="cCode">EarthClientApp</code> application and save the client JAR file, perform the following steps:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp87740"> </a><div class="pSmartList1"><li>Save the application.</li></div><a name="wp87741"> </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="wp95215"> </a><div class="pSmartList1"><li>In the dialog box, choose the URI for the remote system (<code class="cCode">earth</code>) from the Server menu:</li></div><a name="wp87883"> </a><p class="pBodyRelative"><code class="cVariable">system-name</code><code class="cCode">:4848</code></p><a name="wp87881"> </a><div class="pSmartList1"><li>Type your administrative user name and password (if they are not already filled in).</li></div><a name="wp93880"> </a><div class="pSmartList1"><li>In the Application Client Stub Directory area, select the Return Client Jar checkbox.</li></div><a name="wp93885"> </a><div class="pSmartList1"><li>Choose Browse to navigate to the directory on the remote system (<code class="cCode">earth</code>) from which you will run the client. When you reach the directory, click Select, then click OK. </li></div><a name="wp93899"> </a><div class="pSmartList1"><li>Click OK.</li></div><a name="wp87744"> </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">EarthClientAppClient.jar</code> in the specified directory.</li></div></ol></div><a name="wp87904"> </a><p class="pBody">To deploy the <code class="cCode">MarsMDBApp</code> application, perform the following steps:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp87917"> </a><div class="pSmartList1"><li>Save the application.</li></div><a name="wp94877"> </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="wp95220"> </a><div class="pSmartList1"><li>In the dialog box, choose the URI for <code class="cCode">localhost</code> from the Server menu.</li></div><a name="wp87921"> </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="wp87923"> </a><div class="pSmartList1"><li>In the Distribute Module dialog box, click Close when the process completes.</li></div></ol></div><a name="wp87612"> </a><h3 class="pHeading2">Running the Application Client</h3><a name="wp87754"> </a><p class="pBody">To run the client, perform the following steps:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp91053"> </a><div class="pSmartList1"><li>Go to the directory on the remote system (<code class="cCode">earth</code>) where you created the client JAR file.</li></div><a name="wp91054"> </a><div class="pSmartList1"><li>Use the following command:</li></div><a name="wp87755"> </a><p class="pBodyRelative"><code class="cCode">appclient -client EarthClientAppClient.jar</code></p></ol></div><a name="wp83333"> </a><p class="pBody">On <code class="cCode">earth</code>, the output of the <code class="cCode">appclient</code> command looks like this:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">Sending message: This is message 1Sending message: This is message 2Sending message: This is message 3<a name="wp83569"> </a></pre></div><a name="wp83567"> </a><p class="pBody">On <code class="cCode">mars</code>, the output in the server log looks like this:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">In MessageBean.MessageBean()In MessageBean.setMessageDrivenContext()In MessageBean.ejbCreate()MESSAGE BEAN: Message received: This is message 1MESSAGE BEAN: Message received: This is message 2MESSAGE BEAN: Message received: This is message 3<a name="wp83596"> </a></pre></div> </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="JMSJ2EEex3.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="JMSJ2EEex5.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 + -