BEA Home | Events | Solutions | Partners | Products | Services | Download | Developer Center | WebSUPPORT
| WebLogic Server Doc Home | Deployment Tutorial | Previous Topic | Next Topic | Contents | View as PDF

Hands-On: Deploying the Sample Banking Application

The following sections show you step by step how to deploy the sample banking application on WebLogic Server.

- Prerequisites

- Set Up the Application Directory

- Generate the Descriptors

- Edit web.xml

- Edit weblogic.xml

- Edit weblogic-ejb-jar.xml

- Edit weblogic-cmp-rdbms-jar.xml

- Edit application.xml

- Insert Cloudscape Data

- Server Startup

- Set Up a Connection Pool

- Configure RMI Logger Startup Class

- Deploy the Exploded Application

Prerequisites

To work through this tutorial, you need:

- WebLogic Server 6.1
  http://commerce.bea.com/downloads/weblogic_server.jsp

  This evaluation copy is WebLogic Server Premium Edition, with all features. You can also run this tutorial on WebLogic Server Advantage Edition, if you have that version installed.

  You cannot, however, use WebLogic Express for this tutorial.

- The sample banking application, banking.zip
  http://e-docs.b ea.com/wls/docs61/samples.html

- The BEA XML Editor or XML editor:
  http://dev2dev.bea.com/resourcelibrary/utilitiestools/index.jsp

The instructions in this tutorial are specific to Microsoft Windows, but can be easily adapted to UNIX platforms.

Notes

- In the hands-on instructions, a pathname like this

  yourWebLogic\config\mydomain

  asks you to substitute the name of your WebLogic Server directory for yourWebLogic.

- When you see an instruction like this:

  cd %WL_HOME%\config\mydomain

  it means enter the command using an environment variable: %WL_HOME% on Windows, or $WL_HOME on Unix.

- When you see bankingHome, it means the root location of the banking application.

Set Up the Application Directory

1. Download banking.zip from the tutorials website and unzip it to your c: drive.

   You should see a directory structure like this:

   >     banking\
   >     	dev\
   >     		ejb\
   >     		web\
   >     	deploy\
   >     			ejb\
   >     				META-INF\
   >     			web\
   >     				WEB-INF\
   >     					  		classes\
   >     				  lib\

   If you are working on Windows, the META-INF directory might look like it has a mixed case name, like Meta-inf.

2. Open a command window.

3. Set up your shell environment to run the build script:

   >     cd yourWeblogicDirectory\config\mydomain
   >     setEnv

4. Add the location of the compiled EJB classes to your class path:

   >     set CLASSPATH=bankingHome\deploy\ejb;%CLASSPATH%

5. Run the build script to compile the servlet and enterprise bean classes to the correct locations:

   >     cd bankingHome\dev

   >     build

6. Copy the JSP and HTML files and images to the deploy directory:

   >     cd bankingHome\dev\web
   >     copy images bankingHome\deploy\web
   >     copy html bankingHome\deploy\web

   Note that you are moving the JSP and HTML files to deploy\web, not deploy\web\html.

Generate the Descriptors

1. Move to the deploy directory:

   >     cd bankingHome\deploy

2. Generate the web application descriptors:

   >     java weblogic.ant.taskdefs.war.DDInit web

   This step generates the web.xml and weblogic.xml descriptors and stores them in web\WEB-INF.

3. Generate the EJB descriptors:

   >     java weblogic.ant.taskdefs.ejb.DDInit ejb

   This step generates ejb-jar.xml, weblogic-ejb-jar.xml, and weblogic-cmp-rdbms-jar.xml and stores them in ejb\META-INF.

Edit web.xml

1. With the XML editor of your choice, open bankingHome\deploy\web\WEB-INF\web.xml.

2. Delete all <servlet> and <servlet-mapping> entries referring to:

   AccountDetail

   error

   They are unnecessary.

3. Map BankAppServlet in <servlet-mapping> as follows: <url-pattern>/banking</url-pattern>

4. Save the file.

Edit weblogic.xml

1. Open the generated weblogic.xml in your XML editor.

2. Replace the existing DOCTYPE statement with this one, all on one line:

   >     <!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web
   >     Application 6.1//EN"
   >     "http://www.bea.com/servers/wls610/dtd/weblogic-web-jar.dtd">

3. Save the file.

Edit weblogic-ejb-jar.xml

1. Open the generated bankingHome\deploy\ejb\META-INF\weblogic-ejb-jar.xml in your XML editor.

2. Change the value of <jndi-name> to:

   >     <jndi-name>containerManaged.AccountHome</jndi-name>

3. Save the file.

Edit weblogic-cmp-rdbms-jar.xml

1. Open bankingHome\deploy\ejb\META-INF\weblogic-cmp-rdbms-jar.xml in your XML editor.

2. Search for findByPrimaryKey. Delete <finder>findByPrimaryKey</finder>.

3. Change the value of <pool-name> to:

   >     <pool-name>demoPool</pool-name>

4. Change the value of <table-name> to:

   >     <table-name>ejbAccounts</table-name>

5. Change the following <dbms-column> values:

   1. from <dbms-column>accountIdColumn</dbms-column>

      to <dbms-column>id</dbms-column>

   2. from <dbms-column>balanceColumn</dbms-column>

      to <dbms-column>bal</dbms-column>

   3. from <dbms-column>accountTypeColumn</dbms-column>

      to <dbms-column>type</dbms-column>

6. Search for findAccount and change the value of <finder-query> to:

   >     <![CDATA[(= balance $0)]]>

7. Search for findBigAccounts and change the value of <finder-query> to:

   >     <![CDATA[(> balance $0)]]>

8. Search for findNullAccounts and change the value of <finder-query> to:

   >     <![CDATA[(isNull accountType)]]>

9. Save the file.

Edit application.xml

1. Copy the application.xml file included in the zip file to the right location for deployment:

   >     copy bankingHome\dev\application.xml
   >     bankingHome\deploy\META-INF

2. Open application.xml in your XML editor.

3. Edit the values of <ejb> and <web-uri> to use the names of your EJB and web module directories.

   If you are using the sample directory structure, you do not need to change application.xml. The elements would look like this:

   >     <module>
   >     	<ejb>\ejb</ejb>
   >     </module>
   >     <module>
   >     	<web>
   >     		<web-uri>\web</web-uri>
   >     		<context-root>banking</context-root>
   >     	</web>

4. Save the file.

Insert Cloudscape Data

1. Set your environment:

   setEnv.cmd

2. Add %WL_HOME%\samples\eval\cloudscape\lib\cloudscape.jar to CLASSPATH.

3. Execute banking.ddl:

   >     java utils.Schema jdbc:cloudscape:%WL_HOME%\samples\eval\cloudscape\data\demo
   >     COM.cloudscape.core.JDBCDriver -verbose bankingHome\dev\ejb\banking.ddl

Server Startup

1. Before starting the server, add the following.

   1. To startWebLogic.cmd:

      -Dcloudscape.system.home=%WL_HOME%/samples/eval/cloudscape/data

   2. To the startup CLASSPATH in the startWebLogic.cmd:

      %WL_HOME%\samples\eval\cloudscape\lib\cloudscape.jar;

      bankingHome\deploy\ejb

2. Start WebLogic Server:

   >     cd %WL_HOME%\config\mydomain
   >     startWebLogic

Set Up a Connection Pool

1. Start the Administration Console by opening a Web browser and browsing to

   http://localhost:7001/console

   Or, if you specified a different host name or listen port when you installed the server, use those.

2. In the left pane, click JDBC --> Connection Pools.

3. In the right pane, click Configure a New JDBC Connection Pool.

4. Enter these values:

5. Name demoPool
   URL jdbc:cloudscape:demo
   Driver Classname COM.cloudscape.core.JDBCDriver

6. Click Create.

7. Click the Target tab.

   1. In the right pane, click the Targets tab.

   2. Select myserver from the Available column.

   3. Click the right arrow, then click Apply.

Configure RMI Logger Startup Class

1. Go to Startup & Shutdown under Deployments.

2. Click Configure a new Startup Class.

3. Enter the following:

   >     Name: rmilogger

   >     ClassName: examples.tutorials.migration.banking.RMILoggerImpl

4. Click Create

5. Target the Startup Class:

   1. Click the Target tab.

   2. In the right pane, click the Targets tab.

   3. Select myserver from the Available column.

   4. Click the right arrow, then click Apply.

Deploy the Exploded Application

1. In the Administration Console, click Deployments > Applications in the left pane.

2. In the right pane, click Configure a New Application.

3. For Name, enter banking-exploded.

4. For Path, enter bankingHome\deploy .

5. Make sure the Deployed box is checked.

6. Click Create.

7. In the left pane, expand banking-exploded. You should see the ejb and web modules listed beneath it.

8. Target the server for the web module:

   - In the left pane, click \web.

   - In the right pane, click the Targets tab.

   - Select myserver from the Available column.

   - Click the right arrow, then Apply.

9. Target the server for the ejb module:

   - In the left pane, click \ejb.

   - In the right pane, click the Targets tab.

   - Select myserver from the Available column.

   - Click the right arrow, then Apply.

10. To start the banking application, open a Web browser and go to this URL:

    >      http://localhost:7001/banking/login.html

Copyright © 2001 BEA Systems, Inc. All rights reserved. Required browser: Netscape 4.0 or higher, or Microsoft Internet Explorer 4.0 or higher.