WebLogic Server 8.1 Upgrade Guide
|
Upgrading Example Applications to WebLogic Server 8.1
This appendix presents examples of application upgrades from earlier versions of WebLogic Server. It contains the following sections:
Note: WebLogic Server 8.1 examples and PetStore are configured to use the default security configuration. It is not possible to run the WebLogic Server 8.1 examples and PetStore using Compatibility security.
Terms Used in This Document
Where several versions of WebLogic Server are being discussed, the instructions use version-specific terms for WebLogic home directories.
In this document WL_HOME signifies a root directory of one of your WebLogic Server installations.
For 6.0 WL_HOME=D:\WLS_6.0\wlserver6.0
For 6.1 WL_HOME=D:\WLS_6.1\wlserver6.1
For 7.0 WL_HOME=D:\WLS_7.0\weblogic700
For 8.1 WL_HOME=D:\WLS_8.0\weblogic810
Upgrading the Pet Store Application from WebLogic Server 7.0 to WebLogic Server 8.1
The procedures described below assume that WebLogic Server 7.0 and WebLogic Server 8.1 are both installed.
Configure a Domain for Petstore in WebLogic Server 8.1
- Start the Domain Configuration Wizard from the Start menu at Start | BEA WebLogic Platform 8.1 Server | Domain Config Wizard.
- Select a template for the new Pet Store domain. In the Domain Wizard's Choose Domain Type and Name dialog, select the WLS Domain template.
- In the same dialog, give the new domain a name. Name it petstore70domain. Then click Next.
- In the Choose Server Type dialog, select Single Server and then click Next.
- In the Select Directory for Domain dialog, see that the domain directory is C:\bea81beta\user_projects\ and then click Next.
- In the Configure Standalone/Admin Server dialog, configure as follows:
Server Name: petstore70server
Server Listen Port: 7001
Server SSL Listen Port 7002
Click Next.
- In the Create Administrative User dialog, specify a user name and password and then click Next.
- In the Install Server as a Windows Service dialog, make sure that "No, do not register server as a Windows Service..." is selected, and then click Next
- In the Create Start Menu Entry For Server dialog, create or don't create a Start menu entry and then click Next to see a summary of the domain, petstore70domain.
- Review the summary. It should look like this:
Domain Name: petstore70domain
Server Type: Single Server (Standalone Server)
Domain Template Name: WLS Domain
Server Name: petstore70server
Install Directory: C:\bea81beta\user_projects\petstore70domain
Listen Address: localhost and primary IP address
Listen Port: 7001
SSL Listen Port: 7002
Windows Service: no
Windows Start Menu: no
User Name: weblogic
Password: ********
- Create the new domain by clicking Create.
- Confirm that the new domain exists by navigating to its install directory in a command console and entering the command:
startexamplesserver
Enter the user name and password to start the server.
Configure Data and Services
Set Up and Start PointBase
- In WL_HOME\user_projects\petstore70domain, open startWebLogic.cmd (or .sh).
- Add %POINTBASE_CLASSPATH% to the startWebLogic classpath. (POINTBASE_CLASSPATH is not declared in this script, but is declared via %WL_HOME%\common\bin\commEnv.cmd.)
Tip: set your username and password in WLS_USER and WLS_PW, so you don't have to enter them if you should have to reboot the server.
- In a command console, start PointBase from WL_HOME\samples\server\eval\pointbase\tools:
startPointBase.cmd (or .sh)
Configure Connection Pools
This section tells how to set up three connection pools that Pet Store will need. It describes the steps for configuring the first connection pool, and gives the values for the other two.
- In a command console, start WebLogic Server at WL_HOME\user_projects\petstore70domain:
startWebLogic.cmd (or .sh)
- In a browser, go to the Administration Console at http://localhost:7001/console.
- In the left hand navigational pane, go to Services | JDBC | Connection Pool, and then click Configure a new connection pool in the right hand pane.
- In the Step 1 dialog, select PointBase for Database type and Database driver and click Continue.
- In the Step 2 dialog, assign the following values and then click Continue:
POOL NAME: petstorePool
DATABASE NAME: demo
HOSTNAME: none
DATABASE USER NAME: petstore
DATABASE PASSWORD: petstore
- In the Step 3 dialog, click Skip this Step.
- In the next dialog, click Save Configuration, and a successful save will bring you to the JDBC Connection Pools table.
- In the Configuration tab, click the name of the new connection pool to see its details, and select the Target and Deploy tab.
- In the Target and Deploy tab, check the petstore70server and click Apply.
- For the next connection pool, follow the same steps as for the first one, and assign the following values:
POOL NAME: petstoreopcPool
DATABASE NAME: demo
HOSTNAME: none
DATABASE USER NAME: petstoreopc
DATABASE PASSWORD: petstoreopc
- For the next connection pool, follow the same steps as for the first one, and assign the following values:
POOL NAME: petstoresupplierPool
DATABASE NAME: demo
HOSTNAME: none
DATABASE USER NAME: petstoresupplier
DATABASE PASSWORD: petstoresupplier
Configure Data Sources
In this section, configure four data sources.
- Still in the Administration Console, in the left hand navigational pane select Services | JDBC | Data Sources, and then click Configure a new data source in the right hand pane.
- In the Step 1 dialog, assign the following values to the data source and then click Continue:
NAME: PetstoreDataSource
JNDI NAME: datasource-petstorePool
- In the Step 2 dialog, assign the connection pool name and then click Continue:
POOL NAME: petstorePool
- In the Step 3 dialog, target the server and then click on the Service | JDBC | Data Sources node in the left hand navigational pane:
TARGET: petstore70server
- For the second data source, follow the same steps as for the first but with these values:
NAME: PetstoreOPCDataSource
JNDI NAME: datasource-petstoreopcPool
POOL NAME: petstoreopcPool
TARGET: petstore70server
- For the third data source, follow the same steps and assign these values:
NAME: PetstoreSupplierDataSource
JNDI NAME: datasource-petstoresupplierPool
POOL NAME: petstoresupplierPool
TARGET: petstore70server
- For the fourth and final data source, follow the same steps again and use these values:
NAME: CatalogDataSource
JNDI NAME: jdbc/CatalogDataSource
POOL NAME: petstorePool
TARGET: petstore70server\
Configure JMS Connection Factories
In this section, configure two JMS connection factories for Pet Store.
- Still in the Administration Console, select Services | JMS | Connection Factories in the left hand navigational pane, and then in the right hand pane click Configure a new JMS connection factory.
- In the Step 1 dialog, assign the following values and then click Create:
NAME: Queue
JNDI NAME: jms/QueueConnectionFactory
- In the second dialog, target petstoreServer and click Apply.
- In the right hand pane, select the Configuration tab, and then select the Transaction tab, and check XA Connection Factory Enabled.
- Follow the same steps for the second JMS connection factory, but with these values:
NAME: Topic
JNDI NAME: jms/TopicConnectionFactory
- Return to the Services | JMS | Connection Factories node in the left hand navigational pane, and select the Queue connection factory.
- Go to the Target and Deploy tab in the right hand pane, and target the petstore70server.
- Return again to the Services | JMS | Connection Factories node in the left hand navigational pane, and select the Topic connection factory.
- In the right hand pane, select the Target and Deploy tab and target the petstore70server.
Configure the JMS JDBC Store
- Still in the Administration Console, in the left hand navigational pane select Services | JMS | Stores, and click Configure a new JMS JDBC Store in the right hand panel.
- In the Create a new JMSJDBCStore dialog, assign the following values and then click Create:
NAME: petstoreJDBCStore
CONNECTION POOL: petstorePool
PREFIX NAME: petstore
Configure the JMS Server and Destinations
In this section, configure a JMS server, seven JMS queues, and two JMS topics for Pet Store.
- In the left hand navigational pane of the Administration Console, select Services | JMS | Servers, and then click Configure a new JMS server.
- In the Create a new JMS server dialog, enter the following values and then click Create:
NAME: petstoreJMSServer
STORE: petstoreJDBCStore
- Use the Target and Deploy tab of the newly created JMS server to target the petstore70server.
- On the Configuration tab, click Configure Destinations...
- In the JMS Destinations page, click Configure a new JMSQueue.
- Enter the following values and click Create:
NAME: JPS_ASYNC_SENDER_QUEUE
JNDI NAME: jms/ASYNC_SENDER_QUEUE
- Return to the JMS Destinations page and click Configure a new JMSQueue.
- Enter the following values and click Create:
NAME: SUPPLIER_PO_MDB_QUEUE
JNDI NAME: jms/opcApplication/SUPPLIER_PO_MDB_QUEUE
- Return to the JMS Destinations page and click Configure a new JMSQueue.
- Enter the following values and click Create:
NAME: ORDER_APPROVAL_MDB_QUEUE
JNDI NAME: jms/opcApplication/ORDER_APPROVAL_MDB_QUEUE
- Return to the JMS Destinations page and click Configure a new JMSQueue.
- Enter the following values and click Create:
NAME: JPS_ORDER_QUEUE
JNDI NAME: jms/opcApplication/JPS_ORDER_QUEUE
- Return to the JMS Destinations page and click Configure a new JMSQueue.
- Enter the following values and click Create:
NAME: CR_MAIL_ORDER_APPROVAL_MDB_QUEUE
JNDI NAME: jms/opcApplication/customerrelations/CR_MAIL_ORDER_APPROVAL_MDB_QUEUE
- Return to the JMS Destinations page and click Configure a new JMSQueue.
- Enter the following values and click Create:
NAME: Queue
JNDI NAME: jms/Queue
- Return to the JMS Destinations page and click Configure a new JMSTopic.
- Enter the following values and click Create:
NAME: INVOICE_MDB_TOPIC
JNDI NAME: jms/opcApplication/INVOICE_MDB_TOPIC
- Return to the JMS Destinations page and click Configure a new JMSTopic.
- Enter the following values and click Create:
NAME: Topic
JNDI NAME: jms/Topic
Configure the Mail Session
- In the left hand navigational pane, select Services | Mail, and then click Configure a new Mail Session... in the right hand panel.
- Enter the following values and then click Apply:
NAME: PetstoreMailSession
JNDI NAME: mail/JPSMailSession
PROPERTIES: mail.user=joe;mail.host=mail.mycompany.com
- In the Target and Deploy tab, target the petstore70server.
Deploy and Run Pet Store
- In the left hand navigational pane, select Deployments | Applications, and then click Deploy a new Application... in the right hand pane.
- Use the Deploy a new Application dialog to select petstore.ear at WebLogic Server 7.0 WL_HOME\samples\server\src\petstore\src\apps\admin.
- In the second dialog, ensure that petstore70server is targeted and then click Deploy.
- Return to the Deploy a new Application dialog to select petstoreadmin.ear, opc.ear, and supplier.ear, and deploy each of them as well.
- Interact with the Pet Store application at http://localhost:7001/petstore.
Upgrading the Pet Store Application from WebLogic Server 6.1 Service Pack 4 to WebLogic Server 8.1
The main steps for upgrading Pet Store from WebLogic Server 6.1 to WebLogic Server 8.1 are:
Configure a Domain for Petstore in WebLogic Server 8.1
- Start the Domain Configuration Wizard from the Start menu from Start | BEA WebLogic Platform 8.1 Server | Domain Config Wizard.
- Select a template for the new Pet Store domain. In the Domain Wizard's Choose Domain Type and Name dialog, select the WLS Domain template.
- In the same dialog, give the new domain a name. Name it mypetstoredomain. Then click Next.
- In the Choose Server Type dialog, select Single Server and then click Next.
- In the Select Directory for Domain dialog, enter the directory C:\bea81beta\user_projects\ and then click Next.
- In the Configure Standalone/Admin Server dialog, configure as follows:
Server Name: petstoreserver
Server Listen Port: 7001
Server SSL Listen Port 7002
Click Next.
- In the Create Administrative User dialog, specify a user name and password and then click Next.
- In the Install Server as a Windows Service dialog, make sure that "No, do not register server as a Windows Service..." is selected, and then click Next
- In the Create Start Menu Entry For Server dialog, create or don't create a Start menu entry and then click Next to see a summary of the domain, "mypetstoredomain."
- Review the summary. It should look like this:
Domain Name: mypetstoredomain
Server Type: Single Server (Standalone Server)
Domain Template Name: WLS Domain
Server Name: petstoreserver
Install Directory: C:\bea81beta\user_projects\mypetstoredomain
Listen Address: localhost and primary IP address
Listen Port: 7001
SSL Listen Port: 7002
Windows Service: no
Windows Start Menu: no
User Name: weblogic
Password: ********
- Create the new domain by clicking Create.
- Confirm that the new domain exists by navigating to its install directory in a command console and entering the command:
startweblogic
Enter the user name and password to start the server.
Set Up the Cloudscape Database
To give mypetstoredomain access to the Cloudscape database that Pet Store uses, add the paths to the data directory and the cloudscape.jar file to the mypetstoredomain start script.
- Open the startWebLogic script in the mypetstoredomain install directory, and locate JAVA_HOME ... JAVA_OPTIONS in the CLASSPATH.
- In the JAVA_OPTIONS segment of the CLASSPATH, enter the path the Cloudscape database, which you can copy from the WebLogic 6.1 start script, or from right here:
-Dcloudscape.system.home=WL_HOME\samples\eval\cloudscape\data
- Add the path to cloudscape.jar to the CLASSPATH, copied from the start script or from here:
WL_HOME\samples\eval\cloudscape\lib\cloudscape.jar
Configure a Connection Pool
To configure a connection pool, start the server and use the Administration Console to define its connection properties.
- To start the server, in a command console navigate to the installation directory of the mypetstore domain and enter the command startWeblogic.
- To open the Administration Console, use a browser to navigate to http://localhost:7001/console.
- In the Administration Console, in the left navigational pane, select mypetstoredomain | Services | JDBC | Connection Pools, and click "Configure a new connection pool."
- In the first connection pool configuration dialog, "Step 1 Choose database," specify the database type and database driver:
Database type: Cloudscape
Database driver: Cloudscape driver
and then click Continue.
- In the second dialog, "Step 2 Define connection properties," specify the connection properties as below.
NAME: petstorePool
Under the heading "Connection Properties," continue as follows:
DATABASE NAME: petStore
HOST NAME: none
DATABASE USER NAME: none
PASSWORD: none
"None" means the word "none."
Click Continue.
- In the next dialog, "Step 3 Test database connection,"select Skip this Step.
Configure Data Sources
Still in the Administration Console, configure the three JDBC data sources for Pet Store.
- In the left navigational pane, select mypetstoredomain | Services | JDBC | Data Sources, and then in the right pane select "Configure a new JDBC Data Source."
- In the first dialog, "Step 1 Configure the data source," specify the following configurations for the first data source.
NAME: EstoreDB
JNDI: jdbc.EstoreDB
- Step 2 Connect to connection pool
POOL NAME: petstorePool
- Step 3 Target the data source
TARGET: petstoreserver
- In the left navigational pane, select mypetstoredomain | Services | JDBC | Data Sources, and then in the right pane select "Configure a new JDBC Data Source."
- In the first dialog, "Step 1 Configure the data source," specify the following configurations for the first data source.
NAME: SignOnDB
JNDI: jdbc.SignOnDB
- Step 2 Connect to connection pool
POOL NAME: petstorePool
- Step 3 Target the data source
target: petstoreserver
- In the left navigational pane, select mypetstoredomain | Services | JDBC | Data Sources, and then in the right pane select "Configure a new JDBC Data Source."
- In the first dialog, "Step 1 Configure the data source," specify the following configurations for the first data source.
NAME: InventoryDB
JNDI: jdbc.InventoryDB
- Step 2 Connect to connection pool
POOL NAME: petstorePool
- Step 3 Target the data source
TARGET: petstoreserver
Fix Petstore Bugs
Errors that earlier versions of WebLogic Server overlooked can cause failures in WebLogic Server 8.1. You may need to make some or all of the fixes described in this section.
Missing <ejb-ref-name>
In WebLogic 6.1 WL_HOME\samples\petStore\src\petstore\src\docroot\WEB-INF\weblogic.xml, add the following stanza:
<ejb-reference-description>
<ejb-ref-name>ejb/profilemgr/ProfileMgr</ejb-ref-name>
<jndi-name>estore/profilemgr</jndi-name>
</ejb-reference-description>
Erroneous <ejb-ref-name>
In WebLogic Server 6.1 WL_HOME\samples\petStore\src\components\customer\src\customer_weblogic_ejb.xml, make the following substitutions:
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>TheCustomer</ejb-name>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>ejb/account</ejb-ref-name>
<ejb-ref-name>ejb/account/Account</ejb-ref-name>
<jndi-name>estore/account</jndi-name>
</ejb-reference-description>
<ejb-reference-description>
<ejb-ref-name>ejb/order</ejb-ref-name>
<ejb-ref-name>ejb/order/Order</ejb-ref-name>
<jndi-name>estore/order</jndi-name>
</ejb-reference-description>
</reference-descriptor>
<jndi-name>estore/customer</jndi-name>
</weblogic-enterprise-bean>
Encoding Error
Because of stricter XML parsing, in WebLogic Server 6.1 WL_HOME\samples\petStore\src\petstore\src\docroot\WEB-INF\xml\ja\screendefinitions.xml, change the encoding from "Unicode" to "utf-16".
JSP Parsing Errors
In WebLogic Server 6.1 WL_HOME\samples\petStore\src\petstore\src\com\sun\j2ee\blueprints\petstore\taglib\list\ListTag.java
Change:
public void setNumItems(String numItemsStr) {
numItems = Integer.parseInt(numItemsStr);
}
to
public void setNumItems(int pNumItems) {
numItems = pNumItems;
}
Also, in the same file, change:
public void setStartIndex(String startIndexStr) {
startIndex = Integer.parseInt(startIndexStr);
}
to
public void setStartIndex(int pStartIndex) {
startIndex = pStartIndex;
}
In WebLogic Server 6.1 in the files WL_HOME\samples\petStore\src\petstore\src\com\sun\j2ee\blueprints\petstore\taglib\list\ProductListTag.java and SearchListTag.java
remove
// setters (overloaded to fix bug in tomcat)
public void setNumItems(String numItemsStr) {
super.setNumItems(numItemsStr);
}
public void setStartIndex(String startIndexStr) {
super.setNumItems(startIndexStr);
}
Rebuild Pet Store
After making these changes you need to rebuild the application. Use the following steps:
- In a command console, change to the WL_HOME\config\examples directory and set your environment:
setexamplesenv.cmd (or .sh)
- In the same console, change to the WL_HOME\samples\petStore\src\petstore\src directory and rebuild:
build
The application builds to WL_HOME\samples\petStore\src\petstore\build.
Deploy and Run Pet Store
To test the upgrade of the Pet Store application, run it on WebLogic Server 8.1. Use the deployment assistant in the Administration Console.
- In the left navigational pane of the Administration Console, select mypetstoredomain | Deployments | Applications, and then click Deploy a new Application in the right pane.
- In the Step 1 dialog, select the petstore.ear at WL_HOME\samples\petStore\src\petstore\build.
- In the next dialog, make sure that the petstoreserver is targeted, and click Deploy.
- Purchase a fish using the deployed Pet Store application at http://localhost:7001/estore.
Upgrading the Banking Application from WebLogic Server 5.1 to WebLogic Server 8.1
This example shows a successful upgrade from WebLogic Server 5.1 to WebLogic Server 8.1. The following example assumes an application running on WebLogic Server 5.1 SP12. The example is a simple banking application.
The following two main steps will migrate the banking application from WebLogic Server 5.1 to WebLogic Server 8.1:
Convert the weblogic.properties File
Use the WebLogic 8.1 Administration Console to convert the WebLogic Server 5.1 application's weblogic.properties file.
- Launch the WebLogic Server 8.1 Examples Server from Start | Programs | BEA WebLogic Platform 8.1 Server | WebLogic Server 8.1 | Server Tour and Examples | Launch Examples Server.
- Go to the Administration Console page. On the WebLogic Server Examples page that the Examples Server launches, click the Administration Console link. You will have to login with a username and password.
- In the Administration Console, click "Convert weblogic.properties" to go to the converter. This conversion will write the properties in your WebLogic Server 5.1 weblogic.properties file to XML files for WebLogic Server 8.1 to use in a domain. (For more information about Domains in WebLogic Server, see WebLogic Server Configuration Reference.)
- In the first page of the "Convert weblogic.properties" path ("Step 1 - Locate weblogic root"), browse to select the directory that contains the weblogic.properties file.
The second page of the "Convert weblogic.properties" path appears.
- From a list of available application directories, select the directories that contain your application. The weblogic.properties converter will convert these directories into a WebLogic Server 8.1 domain.
- Fill in the remaining text fields.
- Admin Server Name (migrationserver)
- Output Directory (c:\banco)
- WebLogic Home
- Name for New Domain (migrationdomain)
- Click Convert.
If the conversion is successful, a page will appear with a message something like the following:
New Domain name is migrationdomain
*************************************
Server Name is migrationserver
This server doesn't belong to any cluster
*************************************
Converting Server properties
Converting Server Debug Properties
Converting WebServer properties
Converting WebApp Component Properties
Converting JDBC Specific properties
Converting CORBA IIOP properties
Converting EJB Specific Properties
--- Warning Source File D:\510sp12\migrationserver\app_banking.jar does not exist copy the correct file manually after conversion to C:\banco\applications
Converting StartupClass properties
Converting Shutdown Class properties
Converting MailSession Properties
Converting FileT3 properties
Converting JMS properties
Converting Security Properties
Converting the PasswordPolicy properties
Converting User Group and ACL properties
Creating webApp for the servlets registerd in the properties file
Startup Scripts for the Server are created in the ResultDir C:\banco
Conversion successful.
Configure the Banking Application for WebLogic Server 8.1
To deploy and run the banking application on WebLogic Server 8.1:
Edit the startmigration Script
The weblogic.properties converter generated a script for starting up the banking application's domain. Specify some additional variables to run the banking application in this domain.
- Edit the startmigrationdomain script, adding the following variables:
set APPLICATIONS=%WL51_HOME%\config\migrationdomain\applications
set CLIENT_CLASSES=%WL51_HOME%\config\migrationdomain\clientclasses
set SERVER_CLASSES=%WL51_HOME%\config\migrationdomain\serverclasses
set BANKING_WEBAPP_CLASSES=D:\banking\510sp12\migrationserver\serverclasses\examples\tutorials\migration\banking
set CLOUDSCAPE_CLASSES=%WL51_HOME%\samples\eval\cloudscape\lib\cloudscape.jar
- Append these variables to the startmigrationdomain CLASSPATH:
CLASSPATH=...%APPLICATIONS%;%CLIENT_CLASSES%;%SERVER_CLASSES%;%BANKING_WEBAPP_CLASSES%;%CLOUDSCAPE_CLASSES%
- Add the following setting to the startmigrationdomain script, making sure to add it before the final weblogic.Server:
-Dcloudscape.system.home=WL51_HOME\eval\cloudscape\data
Copy Banking Application Files to the Output Directory
Copy the application jar file and the web application classes and files to the banking directory.
Copy AccountDetail.jsp, error.jsp, login.html to C:\banco\applications\DefaultWebApp_migrationserver.
- Copy app_banking.jar to C:\banco\applications\.
- Copy AccountDetail.jsp, error.jsp, login.html to C:\banco\applications\DefaultWebApp_migrationserver.
- Copy BankAppServlet.class into C:\banco\applications\DefaultWebApp_migrationserver\WEB-INF\classes.
Deploy and Run the Banking Application
Start the application by navigating to c:\banco\ in a command console and entering the command startmigration.
See the application at http://localhost:7001/banking.
Use:
username:system
password:password
account 1000