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

📄 session5.html

📁 j2eePDF格式的电子书
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<a name="wp80614"> </a><div class="pSmartList2"><li>Read the explanatory text for an overview of the wizard's features. </li></div><a name="wp80615"> </a><div class="pSmartList2"><li>Click Next.</li></div></ol></div><a name="wp80616"> </a><div class="pSmartList1"><li> JAR File Contents dialog box</li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp80617"> </a><div class="pSmartList2"><li>Select the button labelled Create New AppClient Module in Application.</li></div><a name="wp80618"> </a><div class="pSmartList2"><li>In the combo box below this button, select <code class="cCode">TimerSessionApp</code>.</li></div><a name="wp80619"> </a><div class="pSmartList2"><li>In the AppClient Display Name field, enter <code class="cCode">TimerSessionClient</code>.</li></div><a name="wp80620"> </a><div class="pSmartList2"><li>Click Edit.</li></div><a name="wp80621"> </a><div class="pSmartList2"><li>In the tree under Available Files, locate the <code class="cVariable">&lt;INSTALL&gt;</code><code class="cCode">/j2eetutorial14/examples/ejb/timersession/build </code>directory.</li></div><a name="wp80622"> </a><div class="pSmartList2"><li>Select the <code class="cCode">TimerSessionClient.class</code> file</li></div><a name="wp80623"> </a><div class="pSmartList2"><li>Click Add. </li></div><a name="wp80624"> </a><div class="pSmartList2"><li>Click OK.</li></div><a name="wp80625"> </a><div class="pSmartList2"><li>Click Next.</li></div></ol></div><a name="wp80626"> </a><div class="pSmartList1"><li>General dialog box </li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp80627"> </a><div class="pSmartList2"><li>In the Main Class combo box, select <code class="cCode">TimerSessionClient</code>.</li></div><a name="wp80628"> </a><div class="pSmartList2"><li>Click Next.</li></div><a name="wp80629"> </a><div class="pSmartList2"><li>Click Finish.</li></div></ol></div></ol></div><a name="wp80630"> </a><h4 class="pHeading3">Specifying the Application Client's Enterprise Bean Reference</h4><a name="wp80631"> </a><p class="pBody">When it invokes the <code class="cCode">lookup</code> method, the <code class="cCode">TimerSessionClient</code> refers to the home of an enterprise bean:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">Object objref =&nbsp;&nbsp;initial.lookup(&quot;java:comp/env/ejb/SimpleTimerSession&quot;);<a name="wp80632"> </a></pre></div><a name="wp80633"> </a><p class="pBody">You specify this reference as follows.</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp80634"> </a><div class="pSmartList1"><li>In the tree, select <code class="cCode">TimerSessionClient</code>.</li></div><a name="wp80635"> </a><div class="pSmartList1"><li>Select the EJB Refs tab.</li></div><a name="wp80636"> </a><div class="pSmartList1"><li>Click Add.</li></div><a name="wp80637"> </a><div class="pSmartList1"><li>In the Coded Name field, enter <code class="cCode">ejb/SimpleTimerSession</code>.</li></div><a name="wp80638"> </a><div class="pSmartList1"><li>In the EJB Type field, select <code class="cCode">Session</code>.</li></div><a name="wp80639"> </a><div class="pSmartList1"><li>In the Interfaces field, select <code class="cCode">Remote</code>.</li></div><a name="wp80640"> </a><div class="pSmartList1"><li>In the Home Interface field, enter <code class="cCode">TimerSessionHome</code>.</li></div><a name="wp80641"> </a><div class="pSmartList1"><li>In the Local/Remote Interface field, enter <code class="cCode">TimerSession</code>.</li></div><a name="wp80642"> </a><div class="pSmartList1"><li>In the JNDI field, enter <code class="cCode">TimerSessionEJB</code>.</li></div><a name="wp80643"> </a><div class="pSmartList1"><li>Click OK.</li></div></ol></div><a name="wp80650"> </a><h4 class="pHeading3">Deploying the Enterprise Application</h4><a name="wp80652"> </a><p class="pBody">Now that the J2EE application contains the components, it is ready for deployment. </p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp80653"> </a><div class="pSmartList1"><li>Select <code class="cCode">TimerSessionApp</code>.</li></div><a name="wp80654"> </a><div class="pSmartList1"><li>Select Tools<span style="font-family: Symbol"><img src="images/arrwrite.gif" border="0" alt="Right Arrow"></span>Deploy.</li></div><a name="wp80655"> </a><div class="pSmartList1"><li>Under Connection Settings, enter the user name and password for the J2EE application server. </li></div><a name="wp80923"> </a><div class="pSmartList1"><li>Under Application Client Stub Directory check Return Client Jar.</li></div><a name="wp80924"> </a><div class="pSmartList1"><li>In the field below the checkbox enter <code class="cVariable">&lt;INSTALL&gt;</code><code class="cCode">/j2eetutorial14/examples/ejb/timersession/</code>.</li></div><a name="wp80656"> </a><div class="pSmartList1"><li>Click OK.</li></div><a name="wp80657"> </a><div class="pSmartList1"><li>In the Distribute Module dialog box click Close when the deployment completes.</li></div><a name="wp80658"> </a><div class="pSmartList1"><li>Verify the deployment.</li></div><div class="pSmartList2"><ol type="a" class="pSmartList2"><a name="wp80659"> </a><div class="pSmartList2"><li>In the tree, expand the Servers node and select the host that is running the J2EE server.</li></div><a name="wp80660"> </a><div class="pSmartList2"><li>In the Deployed Objects table, make sure that <code class="cCode">TimerSessionApp</code> is listed and its status is <code class="cCode">Running</code>.</li></div><a name="wp80931"> </a><div class="pSmartList2"><li>Verify that <code class="cCode">TimerSessionAppClient.jar</code> is in <code class="cVariable">&lt;INSTALL&gt;</code><code class="cCode">/j2eetutorial14/examples/ejb/timersession/.</code></li></div></ol></div></ol></div><a name="wp80671"> </a><h4 class="pHeading3">Running the J2EE Application Client</h4><a name="wp80672"> </a><p class="pBody">To run the J2EE application client, perform the following steps.</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp80673"> </a><div class="pSmartList1"><li>In a terminal window, go to the <code class="cVariable">&lt;INSTALL&gt;</code><code class="cCode">/j2eetutorial14/<br />examples/ejb/timersession/</code> directory.</li></div><a name="wp80674"> </a><div class="pSmartList1"><li>Type the following command:</li></div><a name="wp81596"> </a><p class="pBodyRelative"><code class="cCode">appclient -client TimerSessionAppClient.jar</code> </p><a name="wp81597"> </a><div class="pSmartList1"><li>In the terminal window, the client displays these lines:</li></div><a name="wp80677"> </a><p class="pBodyRelative"><code class="cCode">Creating a timer with an interval duration of 30000 ms.</code> </p></ol></div><a name="wp80678"> </a><p class="pBody">The output from the timer is sent to the server.log located in the <code class="cCode">&lt;</code><code class="cVariable">J2EE_HOME</code><code class="cCode">&gt;/domains/domain1/server/logs/</code> directory. After about 30 seconds, open up <code class="cCode">server.log</code> in a text editor and you will see the following lines:</p><div class="pPreformattedRelative"><pre class="pPreformattedRelative">TimerSessionBean: setSessionContextTimerSessionBean: ejbCreateTimerSessionBean: start createTimer TimerSessionBean: ejbTimeout <a name="wp80679"> </a></pre></div><hr><a name="wp80944"> </a><p class="pNote">Note: To run the <code class="cCode">TimerSessionEJB</code> example, you must start the PointBase server before you start the J2EE application server. If you don&#39;t start the PointBase server, or if you start it after the J2EE application server, then you will get a <code class="cCode">java.rmi.RemoteException</code> with the message, <code class="cCode">EJB Timer service not available</code>.</p><hr>    </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="Session4.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="Session6.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 + -