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

📄 ebank6.html

📁 j2eePDF格式的电子书
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  <head>    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />    <meta http-equiv="Content-Style-Type" content="text/css" />    <title>Building, Packaging, Deploying, and Running the Application</title>    <link rel="StyleSheet" href="document.css" type="text/css" media="all" />    <link rel="StyleSheet" href="catalog.css" type="text/css" media="all" />    <link rel="Table of Contents" href="J2EETutorialTOC.html" />    <link rel="Previous" href="Ebank5.html" />    <link rel="Next" href="Ebank7.html" />    <link rel="Index" href="J2EETutorialIX.html" />  </head>  <body>    <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="Ebank5.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="Ebank7.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">    <blockquote><a name="wp80219"> </a><h2 class="pHeading1">Building, Packaging, Deploying, and Running the Application</h2><a name="wp80221"> </a><p class="pBody">To build the Duke's Bank application, you must have downloaded and unzipped the tutorial bundle as described in <a  href="About.html#wp63740">About the Examples</a>. When you install the bundle, the Duke's Bank application files are located in the <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/bank/</code> directory:</p><a name="wp83010"> </a><p class="pBodyRelative"><code class="cCode">/bank<br />&nbsp;&nbsp;/provided-jars</code> - packaged Web client and J2EE application <br />&nbsp;&nbsp;&nbsp;&nbsp;containing the enterprise beans and application client<br />&nbsp;&nbsp;<code class="cCode">/sql</code> - database scripts<br />&nbsp;&nbsp;<code class="cCode">/src<br /></code>&nbsp;&nbsp;&nbsp;&nbsp;<code class="cCode">/com</code> - component classes<br /><code class="cCode">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/sun/ebank/appclient<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/sun/ebank/ejb<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/sun/ebank/util<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/sun/ebank/web<br /></code>&nbsp;&nbsp;<code class="cCode">/web</code> - JSP pages, images</p><a name="wp83014"> </a><p class="pBody">After you compile the source code, the resulting files will reside in the <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/bank/build/</code> directory.</p><a name="wp82407"> </a><h3 class="pHeading2">Setting Up the Servers</h3><a name="wp82965"> </a><p class="pBody">Before you can package, deploy, and run the example, you must first set up the PointBase database server with customer and account data, and add some resources to the J2EE 1.4 Application Server.</p><a name="wp82942"> </a><h4 class="pHeading3">Creating the Bank Database</h4><a name="wp82943"> </a><p class="pBody">You create and enter data into the appropriate tables so that the enterprise beans have something to read from and write to the database. To create and populate the database tables:</p><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp83430"> </a><div class="pSmartList1"><li>Start the PointBase database server. </li></div><a name="wp83436"> </a><div class="pSmartList1"><li>In a terminal window or command prompt, go to the <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/bank/</code> directory and execute the command <code class="cCode">asant</code> <code class="cCode">create-db_common</code>. This task invokes the PointBase console tool library to execute the SQL contained in <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/bank/sql/bank.sql</code>. The SQL statements in this file delete any existing tables, create new tables, and insert data. The first time the script is run the tables don't exist, so you will see SQL errors. You can just ignore them.</li></div></ol></div><a name="wp82953"> </a><h4 class="pHeading3">Creating the JDBC Data Source</h4><a name="wp82954"> </a><p class="pBody">The Duke's Bank enterprise beans reference the database with the JNDI name <code class="cCode">jdbc/BankDB</code>. That JNDI name must be mapped to a JDBC data source in the J2EE 1.4 Application Server. You create the data source with the Admin Console following the procedures described in <a  href="Resources4.html#wp81695">Defining a Data Source in the J2EE Application Server</a>. When you create the JDBC data source, name it <code class="cCode">jdbc/BankDB</code> and map it to PointBasePool.</p><a name="wp80233"> </a><h4 class="pHeading3">Adding Users and Groups to the File Realm</h4><a name="wp80235"> </a><p class="pBody">To enable the J2EE 1.4 Application Server to determine which users can access enterprise bean methods and resources in the Web client, add users and groups to the server's file security realm with the Admin Console following the procedures described in <a  href="Security3.html#wp299910">Managing Users</a>. Add the users and groups listed in <a  href="Ebank6.html#wp83148">Table 32-10</a>.</p><div align="left"><table border="1" summary="Duke's Bank Users and Groups" id="wp83148">  <caption><a name="wp83148"> </a><div class="pTableTitle">Table 32-10   Duke's Bank Users and Groups&nbsp;</div></caption>  <tr align="center">    <th><a name="wp83154"> </a><div class="pCellHeading">User</div></th>    <th><a name="wp83156"> </a><div class="pCellHeading">Password</div></th>    <th><a name="wp83158"> </a><div class="pCellHeading">Group</div></th></tr>  <tr align="left">    <td><a name="wp83160"> </a><div class="pCellBody"><code class="cCode">200</code></div></td>    <td><a name="wp83162"> </a><div class="pCellBody"><code class="cCode">j2ee</code></div></td>    <td><a name="wp83164"> </a><div class="pCellBody"><code class="cCode">bankCustomer</code></div></td></tr>  <tr align="left">    <td><a name="wp83166"> </a><div class="pCellBody"><code class="cCode">bankadmin</code></div></td>    <td><a name="wp83168"> </a><div class="pCellBody"><code class="cCode">j2ee</code></div></td>    <td><a name="wp83170"> </a><div class="pCellBody"><code class="cCode">bankAdmin</code></div></td></tr></table></div><p class="pBody"></p><a name="wp80274"> </a><h3 class="pHeading2">Compiling the Duke's Bank Application Code</h3><a name="wp81315"> </a><p class="pBody">To compile the enterprise beans, application client, and Web client, go to the <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/bank/</code> directory of the tutorial distribution and execute the command <code class="cCode">asant compile</code>.</p><a name="wp84150"> </a><h3 class="pHeading2">Packaging and Deploying the Duke's Bank Application</h3><a name="wp82070"> </a><p class="pBody">The instructions that follow for packaging and deploying Duke's Bank <em class="cEmphasis">assume that you are familiar with</em> the <code class="cCode">deploytool</code> procedures for packaging enterprise beans, application clients, and Web applications described in previous chapters of the tutorial. If after following these procedures you have trouble deploying or running the application, you can use the EAR and WAR provided in <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/bank/provided-jars/</code> to run the example.</p><a name="wp81234"> </a><h4 class="pHeading3">Packaging the Enterprise Beans</h4><div class="pSmartList1"><ol type="1" class="pSmartList1"><a name="wp84036"> </a><div class="pSmartList1"><li>Invoke the Enterprise Bean wizard for each entity bean in <a  href="Ebank6.html#wp84040">Table 32-11</a>. For each bean, select <code class="cCode">java.lang.String</code> as the Primary Key Class.<div align="left"><table border="1" summary="Duke's Bank Entity Beans" id="wp84040">  <caption><a name="wp84040"> </a><div class="pTableTitle">Table 32-11   Entity Beans&nbsp;</div></caption>  <tr align="center">    <th><a name="wp84048"> </a><div class="pCellHeading">Entity Bean</div></th>    <th><a name="wp84050"> </a><div class="pCellHeading">Home Interface</div></th>    <th><a name="wp84052"> </a><div class="pCellHeading">Local Interface</div></th>    <th><a name="wp84054"> </a><div class="pCellHeading">Implementation Class</div></th></tr>  <tr align="left">    <td><a name="wp84056"> </a><div class="pCellBody"><code class="cCode">AccountBean</code></div></td>    <td><a name="wp84058"> </a><div class="pCellBody"><code class="cCode">AccountHome</code></div></td>    <td><a name="wp84060"> </a><div class="pCellBody"><code class="cCode">Account</code></div></td>    <td><a name="wp84062"> </a><div class="pCellBody"><code class="cCode">AccountBean</code></div></td></tr>  <tr align="left">    <td><a name="wp84064"> </a><div class="pCellBody"><code class="cCode">CustomerBean</code></div></td>    <td><a name="wp84066"> </a><div class="pCellBody"><code class="cCode">CustomerHome</code></div></td>    <td><a name="wp84068"> </a><div class="pCellBody"><code class="cCode">Customer</code></div></td>    <td><a name="wp84070"> </a><div class="pCellBody"><code class="cCode">CustomerBean</code></div></td></tr>  <tr align="left">    <td><a name="wp84072"> </a><div class="pCellBody"><code class="cCode">TxBean</code></div></td>    <td><a name="wp84074"> </a><div class="pCellBody"><code class="cCode">TxHome</code></div></td>    <td><a name="wp84076"> </a><div class="pCellBody"><code class="cCode">Tx</code></div></td>    <td><a name="wp84078"> </a><div class="pCellBody"><code class="cCode">TxBean</code></div></td></tr></table></div></li></div><a name="wp84029"> </a><p class="pBodyRelative">The first time you invoke the wizard, create an EJB JAR module named <code class="cCode">DukesBankEJBJAR</code> in <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/bank/</code> and add the <code class="cCode">ejb</code> and <code class="cCode">util</code> packages under <code class="cCode">&lt;</code><code class="cVariable">INSTALL</code><code class="cCode">&gt;/j2eetutorial14/examples/bank/build/com/sun/ebank/</code> to the JAR.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -