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
To work through this tutorial, you need:
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
- 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.
- Open a command window.
- Set up your shell environment to run the build script:
cd yourWeblogicDirectory\config\mydomain
setEnv
- Add the location of the compiled EJB classes to your class path:
set CLASSPATH=bankingHome\deploy\ejb;%CLASSPATH%
- Run the build script to compile the servlet and enterprise bean classes to the correct locations:
cd bankingHome\dev
build
- 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
- Move to the deploy directory:
cd bankingHome\deploy
- 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.
- 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
- With the XML editor of your choice, open bankingHome\deploy\web\WEB-INF\web.xml.
- Delete all <servlet> and <servlet-mapping> entries referring to:
AccountDetail
error
They are unnecessary.
- Map BankAppServlet in <servlet-mapping> as follows: <url-pattern>/banking</url-pattern>
- Save the file.
Edit weblogic.xml
- Open the generated weblogic.xml in your XML editor.
- 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">
- Save the file.
Edit weblogic-ejb-jar.xml
- Open the generated bankingHome\deploy\ejb\META-INF\weblogic-ejb-jar.xml in your XML editor.
- Change the value of <jndi-name> to:
<jndi-name>containerManaged.AccountHome</jndi-name>
- Save the file.
Edit weblogic-cmp-rdbms-jar.xml
- Open bankingHome\deploy\ejb\META-INF\weblogic-cmp-rdbms-jar.xml in your XML editor.
- Search for findByPrimaryKey. Delete <finder>findByPrimaryKey</finder>.
- Change the value of <pool-name> to:
<pool-name>demoPool</pool-name>
- Change the value of <table-name> to:
<table-name>ejbAccounts</table-name>
- Change the following <dbms-column> values:
- from <dbms-column>accountIdColumn</dbms-column>
to <dbms-column>id</dbms-column>
- from <dbms-column>balanceColumn</dbms-column>
to <dbms-column>bal</dbms-column>
- from <dbms-column>accountTypeColumn</dbms-column>
to <dbms-column>type</dbms-column>
- Search for findAccount and change the value of <finder-query> to:
<![CDATA[(= balance $0)]]>
- Search for findBigAccounts and change the value of <finder-query> to:
<![CDATA[(> balance $0)]]>
- Search for findNullAccounts and change the value of <finder-query> to:
<![CDATA[(isNull accountType)]]>
- Save the file.
Edit application.xml
- 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
- Open application.xml in your XML editor.
- 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>
- Save the file.
Insert Cloudscape Data
- Set your environment:
setEnv.cmd
- Add %WL_HOME%\samples\eval\cloudscape\lib\cloudscape.jar to CLASSPATH.
- 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
- Before starting the server, add the following.
- To startWebLogic.cmd:
-Dcloudscape.system.home=%WL_HOME%/samples/eval/cloudscape/data
- To the startup CLASSPATH in the startWebLogic.cmd:
%WL_HOME%\samples\eval\cloudscape\lib\cloudscape.jar;
bankingHome\deploy\ejb
- Start WebLogic Server:
cd %WL_HOME%\config\mydomain
startWebLogic
Set Up a Connection Pool
- 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.
- In the left pane, click JDBC --> Connection Pools.
- In the right pane, click Configure a New JDBC Connection Pool.
- Enter these values:
- Name demoPool
URL jdbc:cloudscape:demo
Driver Classname COM.cloudscape.core.JDBCDriver
- Click Create.
- Click the Target tab.
- In the right pane, click the Targets tab.
- Select myserver from the Available column.
- Click the right arrow, then click Apply.
Configure RMI Logger Startup Class
- Go to Startup & Shutdown under Deployments.
- Click Configure a new Startup Class.
- Enter the following:
Name: rmilogger
ClassName: examples.tutorials.migration.banking.RMILoggerImpl
- Click Create
- Target the Startup Class:
- Click the Target tab.
- In the right pane, click the Targets tab.
- Select myserver from the Available column.
- Click the right arrow, then click Apply.
Deploy the Exploded Application
- In the Administration Console, click Deployments > Applications in the left pane.
- In the right pane, click Configure a New Application.
- For Name, enter banking-exploded.
- For Path, enter bankingHome\deploy .
- Make sure the Deployed box is checked.
- Click Create.
- In the left pane, expand banking-exploded. You should see the ejb and web modules listed beneath it.
- 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.
- 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.
- 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.
|