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

📄 package-summary.html

📁 学习J2EE的好事例
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<li>Select the Target tab in the right pane.

<p>
<li> Verify that the EJB is deployed on the examplesServer.
<p>
This example contains a pre-configured servlet running in a browser called examplesWebApp.
<p>
<li>Click the Web Applications node in the left pane and select examplesWebApp. 
<p>
<li>In the right pane, select the Target tab, and verify that the examplesWebApp is deployed on the examplesServer.
<p>
<li>Set the database persistence.

<p>
With database persistence, each instance of an EJBean is written to a
row in a table. The table (<font face="Courier New"
size=-1>ejbAccounts</font>) must be created and exist in the database
before the example is run. If you are using the evaluation
copy of Cloudscape that is included with WebLogic, this table
has already been created in the "demo" database. 

If you're using a database other than Cloudscape, you'll need to
create the table in your database using an appropriate SQL
statement such as

<pre><font face="Courier New">"create table ejbAccounts (id varchar(15), bal float, type varchar(15))"</font></pre>

<p>
<li>Setup a connection pool in the <font face="Courier New"
size=-1>Administration Console</font> . 

<p>For your convenience, a sample connection pool, called <font face="Courier New"
size=-1>demoPool</font> is included with this example. You can use this connection pool 
with any of the EJB examples. </p>
<p>
You'll need to:
<p>
<ul>
<li>Make sure that the connection is available for use. 
  <p># In the left pane, expand the Services node and choose JDBC.
  <p># Click Connections Pool and then demoPool to display the configuration information in the right pane.
  <p># Click the Connections tab and review the attribute settings to make sure that they are correct.
  </li>
  
  <p> 
In particular, make sure that the URL and Driver Classname attributes are set for the correct 
database. This example connection pool is pre-configured for Cloudscape. For other databases, 
you will need to set an appropriate url and driver, such as

<pre><font face="Courier New">	  URL=jdbc:weblogic:oracle,\
	  DriverName=weblogic.jdbc.oci.Driver,\</font></pre>
</ul>
<p>
In this example, the fileRealm for the access control list (ACL) is pre-configured to allow
access for <font face="Courier New">everyone</font>.
<p>
If you need more information about how to use connection pools, read
<a href="http://e-docs.bea.com/wls/docs60/jdbc/index.html">Programming WebLogic JDBC</a>.
</ol>
<h3><a name="Run the example"></a>Run the example</h3>

<ol>

<li>Run the client in a separate command line window. Set up your client as described in 
<a href=../../../examples.html#environment>Setting up your environment</a>,
and then run the client by entering:
<!--
<pre><font face="Courier New">$ <b>java examples.ejb.basic.beanManaged.Client</b></font></pre>

<p>
If you're not running the WebLogic Server with its default settings,
you will have to run the client using:
-->
<pre><font face="Courier New">$ <b>java examples.ejb.basic.beanManaged.Client "t3://<font color=navy><i>WebLogicURL</i>:<i>Port</i>"</b></font></font></pre>

<p>
where:

<p>
<dl>
<dt>WebLogicURL
<dd>Domain address of the WebLogic Server
<dt>Port
<dd>Port that is listening for connections
(<font face="Courier New" size=-1>weblogic.system.ListenPort</font>)
</dl>

<p>
<li>If you're running the <font face="Courier New" size=-1>Client</font> example, 
you should get output similar to this from the client application:

<pre><font face="Courier New">Beginning beanManaged.Client...

Trying to find account with id: ID: 0
Trying to find account with id: ID: 1
Trying to find account with id: ID: 2
Trying to find account with id: ID: 3
Trying to find account with id: ID: 4
Trying to find account with id: ID: 5
Trying to find account with id: ID: 6
Trying to find account with id: ID: 7
Trying to find account with id: ID: 8
Trying to find account with id: ID: 9
Trying to find account with id: ID: 10
Trying to find account with id: ID: 11
Trying to find account with id: ID: 12
Trying to find account with id: ID: 13
Trying to find account with id: ID: 14
Trying to find account with id: ID: 15
Trying to find account with id: ID: 16
Trying to find account with id: ID: 17
Trying to find account with id: ID: 18
Trying to find account with id: ID: 19
Account: :ID: 0 has a balance of 0.0
Account: :ID: 1 has a balance of 1000.0
Account: :ID: 2 has a balance of 2000.0
Account: :ID: 3 has a balance of 3000.0
Account: :ID: 4 has a balance of 4000.0
Account: :ID: 5 has a balance of 5000.0
Account: :ID: 6 has a balance of 6000.0
Account: :ID: 7 has a balance of 7000.0
Account: :ID: 8 has a balance of 8000.0
Account: :ID: 9 has a balance of 9000.0
Account: :ID: 10 has a balance of 10000.0
Account: :ID: 11 has a balance of 11000.0
Account: :ID: 12 has a balance of 12000.0
Account: :ID: 13 has a balance of 13000.0
Account: :ID: 14 has a balance of 14000.0
Account: :ID: 15 has a balance of 15000.0
Account: :ID: 16 has a balance of 16000.0
Account: :ID: 17 has a balance of 17000.0
Account: :ID: 18 has a balance of 18000.0
Account: :ID: 19 has a balance of 19000.0

Querying for accounts with a balance greater than 5000.0...
Account ID: 6; balance is $6000.0
Account ID: 7; balance is $7000.0
Account ID: 8; balance is $8000.0
Account ID: 9; balance is $9000.0
Account ID: 10; balance is $10000.0
Account ID: 11; balance is $11000.0
Account ID: 12; balance is $12000.0
Account ID: 13; balance is $13000.0
Account ID: 14; balance is $14000.0
Account ID: 15; balance is $15000.0
Account ID: 16; balance is $16000.0
Account ID: 17; balance is $17000.0
Account ID: 18; balance is $18000.0
Account ID: 19; balance is $19000.0
Removing beans...

End beanManaged.Client...
</font></pre>

<li>If you're running the servlet example, 
you should get output similar to this:

<pre><font face="Courier New">Using user user1 and password user1Password


Looking up account 10020...
Did not find 10020
Account 10020 being created; opening balance is $3000.0


Part A: Depositing $100.0
Current balance is $3100.0


Withdrawing amount greater than current balance. Expecting an
exception...
Received expected Processing Error:
examples.ejb.basic.beanManaged.ProcessingErrorException: Request to
withdraw $3110.0 more than balance 3100.0 in account 10020


Part B: Creating 5 new accounts...
Created account: 9543031558300; balance is $0.0
Created account: 9543031558301; balance is $100.0
Created account: 9543031558302; balance is $200.0
Created account: 9543031558303; balance is $300.0
Created account: 9543031558304; balance is $400.0


5 accounts successfully created


Querying for accounts with a balance greater than 200.0...
Account 10020; balance is $3100.0
Account 9543031558303; balance is $300.0
Account 9543031558304; balance is $400.0


Removing accounts just created...
Removed account: 9543031558300
Removed account: 9543031558301
Removed account: 9543031558302
Removed account: 9543031558303
Removed account: 9543031558304


End beanManaged.Servlet...</pre></font>


</ol>
<h2>There's more...</h2>

Read more about EJB in 
<a href="http://e-docs.bea.com/wls/docs60/ejb/index.html">BEA WebLogic
Server Enterprise Java Beans</a>.
<P>
<HR>

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../examples/overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</td><td valign=bottom align=right>Documentation is available at<br> <a href=http://e-docs.bea.com/wls/docs60>http://e-docs.bea.com/wls/docs60</a></td></EM>
</TD>
</TR>

</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<a href=http://e-docs.bea.com/wls/docs60/copyright.html>Copyright</a> &copy; 2000 BEA Systems, Inc. All Rights Reserved.
</BODY>
</HTML>

⌨️ 快捷键说明

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