bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

WebLogic Builder Online Help

 Previous Next Contents Index View as PDF  

Porting and Deploying Applications with WebLogic Builder

This example shows a rapid deployment scenario for Sun's BluePrint wireless application, Smart Ticket. We use WebLogic Builder to generate and edit the WebLogic Server-specific deployment descriptor files and to deploy the application on WebLogic Server.

This tutorial contains the following sections:

Procedures

Step :1 Setting Up Applications and Environment

You'll need the following to run this example.

Here are the installation and build tasks and the path-settings you'll need.

  1. Download and install WebLogic Server 7.0.

    Download WebLogic Server 7.0 from http://www.bea.com and install it to a location we will hereafter call WL_HOME. By default, WL_HOME is c:\bea\weblogic700.

  2. Download and install Smart Ticket 1.1.

    Download the Smart Ticket demo application source code at: http://developer.java.sun.com/developer/releases/smarticket/. Extract it into a new directory on your machine. We will call this directory SMARTICKET_HOME.

  3. Download and install J2ME to a location we will call J2MEWTK_HOME (say, C:\J2mewtk).

    Download the Sun Wireless toolkit at: http://java.sun.com/products/j2mewtoolkit/download.html. Install the toolkit. During installation you will be prompted to select a JDK. You can select the JDK included in your BEA_HOME/jdk131 directory.

  4. Set J2MEWTK_HOME=C:\J2mewtk, assuming C:\J2mewtk is where you installed J2ME. Note: if you do not set J2MEWTK_HOME, you will not be able to build the application.
  5. Set your environment by running the setExamplesEnv script located in WL_HOME\samples\server\config\examples.
  6. To SMARTICKET_HOME \smarticket\localant.bat, add "%CLASSPATH%" to the end of the ANT_CLASSPATH line.
  7. Change to the SMARTICKET_HOME\smarticket directory and build Smart Ticket by running localant.bat . WebLogic Builder requires compiled .class files and cannot use .java files.

Step 2: Generating Deployment Descriptors

In this sequence, WebLogic Builder reads the descriptor files that are included with the application and introspects the application's .class files to create the deployment descriptor files that help an application to run on WebLogic Server.

Note that WebLogic Builder will not overwrite the application's existing deployment descriptor files.

  1. Open WebLogic Builder from Start | Programs | BEA WebLogic Platform | WebLogic Server 7.0 | WebLogic Builder.
  2. In WebLogic Builder's File | Open menu, navigate to SMARTICKET_HOME \build\server and click Open. A dialog asks: "Unable to locate deployment descriptors. Would you like deployment descriptors created for you?" Click Yes, and WebLogic Builder will introspect the Smart Ticket class files and generate weblogic.xml and weblogic-ejb-jar.xml.
  3. Select File | Save and save the application in WebLogic Builder.
  4. In WebLogic Builder, create smarticket.ear by selecting File | Archive and specifying SMARTICKET_HOME \bin\smarticket.ear.
  5. Start the Examples server from: Start | Programs | BEA WebLogic Platform | WebLogic Server 7.0 | Server Tour and Examples | Launch Examples Server. The Examples Server launches a WebLogic Server Examples page.
  6. Open the WebLogic Server Administration Console by navigating to http://localhost:7001/console (or by following the link from the WebLogic Server Examples page), and sign in using username weblogic and password weblogic.

Step 3: Specifying <context-root>

In this step, we set the web application's context path using the <context-root> element.

  1. In WebLogic Builder, select the \web node's Context Path tab.
  2. In the Context Path text field, enter SmarTicketApp.

Now the application's <context-root> element is specified.

Step 4: Specifying JNDI Names

In this sequence, we:

  1. Select Builder's EJB Refs panel in the J2EE Refs node, and specify the JNDI names for the EJB Refs as follows:

    Reference Name

    EJB Type

    JNDI Name

    ejb/MovieInfo

    Session

    MovieInfo

    ejb/TicketSales

    Entity

    TicketSales

    ejb/Customer

    Entity

    Customer

    ejb/LocaleInfo

    Session

    LocaleInfo


     


     

  2. Select the Resource Refs panel in Builder's J2EE Refs node and set the Ref Name, EJB Type, and JNDI Name as in the table below. Set the Resource Authentication Type to Container.


     

    Reference Name

    Reference Type

    JNDI Name

    jdbc/MovieInfoDataSource

    java.sql.DataSource

    MovieInfoDataSource

    jdbc/TicketSalesDataSource

    java.sql.DataSource

    TicketSalesDataSource

    jdbc/CustomerDataSource

    java.sql.DataSource

    CustomerDataSource

    jdbc/LocaleInfoDataSource

    java.sql.DataSource

    LocaleInfoDataSource


     
  3. Select the Resource References panel from Builder's EJB Resources node and set JNDI names for EJB Resources as in the table below.

    Reference Reference Name

    Resource Reference Type

    JNDI Name

    jdbc/MovieInfoDataSource

    java.sql.DataSource

    MovieInfoDataSource

    jdbc/TicketSalesDataSource

    java.sql.DataSource

    TicketSalesDataSource

    jdbc/CustomerDataSource

    java.sql.DataSource

    CustomerDataSource

    jdbc/LocaleInfoDataSource

    java.sql.DataSource

    LocaleInfoDataSource


     
  4. Use Builder's File | Save to save changes to the archive.

Step 5: Configuring Data Sources

Now we use the WebLogic Server Administration Console to configure the Data Sources for each of the four EJBs the Smart Ticket application uses.

  1. If you haven't already started the WebLogic Server Examples Server and opened the Administration Console by pointing a browser to http://localhost:7001/console, do so now.
  2. Select the JDBC node and click Tx Data Sources.
  3. Select Configure a new JDBC Tx Data Source.
  4. Enter a name for the data source. The first one is MyCustomerDataSource. Enter CustomerDataSource in the JNDI field. Enter demoPool as your Pool Name; this is the default connection pool that WebLogic Server examples use. Click Create.
  5. Click the Targets Tab, then select the examplesServer in the Available column and click on the right arrow to target it. Click Apply.
  6. Repeat steps 4 and 5 for the other four data sources (MyMovieInfoDataSource, MyLocaleInfoDataSource, and MyTicketSalesDataSource).
  7. To replace Smart Ticket's Cloudscape database with Pointbase, the evaluation RDBMS included with WebLogic Server 7.0, just add the following to SMARTICKET_HOME \smarticket\populate.bat:
    set POINTBASEHOME=%SAMPLES_HOME%\server\eval\pointbase 
    java utils.Schema jdbc:pointbase:server://localhost/demo,database.home=%POINTBASEHOME% com.pointbase.jdbc.jdbcUniversalDriver -u examples -p examples -verbose ./src/smarticketPointBase.sql
  8. We are also making the smarticket.sql Pointbase friendly by replacing it with a script that substitutes "int" data types with "integer." Copy smarticketPointBase.sql from into SMARTICKET_HOME \smarticket\src.
  9. Set up the database by running populate.bat.

Step 6: Deploying the Application

Now we are ready to deploy and run Smart Ticket on WebLogic Server 7.0.

  1. Connect to the server using the Connect to Server dialog in WebLogic Builder's Tools menu.


     

  2. Deploy Smart Ticket by selecting Deploy Module from the WebLogic Builder tools menu.
  3. Set the port in SMARTICKET_HOME\bin\smarticket.jad by replacing the given port number (8000) with the port number of the Examples server, which by default is 7001.
  4. Start SMARTICKET_HOME\bin\smarticket.jad by double-clicking it or by selecting Start | J2ME Wireless Application | Run MIDP Application and selecting it:
  5. You are running the Smart Ticket application on the Examples Server.

Step 7: Running the Wireless Application

When creating a user account for the Smart Ticket Application, enter in 95130 or 95054 for your zip code; also, your password must be 6 characters long. Try selecting the 'Poster' mode when you create an account; this will enable your phone or emulator to view a picture of the movie you choose to see.

There are several options available for using the emulator. Go into your J2ME Wireless Ticket and manipulate the default device and preferences.

If you have run the client Smart Ticket application before and are redeploying the application on WebLogic, you will have to clear the database of the previous users information. To do so, run the J2ME Wireless Ticket Utility which is available from the Windows start menu. Click on 'Clean Database'. Then restart the Smart Ticket Client.

Big Picture

WebLogic Builder is a visual environment for generating and editing an application's deployment descriptor files. You can view descriptor files while you visually edit them in WebLogic Builder, and you won't need to make textual edits to the XML. See WebLogic Builder.

We downloaded the Sun application, built it, and used WebLogic Builder to generate the weblogic.xml and weblogic-ejb-jar.xml files required to run it on WebLogic Server. We then edited the application's elements slightly using WebLogic Builder, and used the WebLogic Server Administration Console to configure the application's data sources. We used WebLogic Builder to deploy the application, which we then launched and ran.

Related Reading

See the procedure for porting Smart Ticket to WebLogic Server 7.0 without using WebLogic Builder: Java Smart Ticket Demo 1.1 at http://download.oracle.com/docs/cd/E13222_01/wls/docs70/quickstart/smarticket.html.

 

Back to Top Previous Next