![]() |
![]() |
WebLogic Server Examples GuideThis document describes the various resources provided with the code examples shipped with BEA WebLogic ServerTM. For a listing of the examples and instructions, see the WebLogic Server Examples Index.
Where do I start?Begin by checking out the WebLogic Server Examples Index. The examples are organized by the API they demonstrate. Each example contains step-by-step instructions for building, configuring, and running the example. Many of the examples refer to back to this document for instructions on using the various resources included with the examples.Setting Up Your Environment for Building and Running the ExamplesWhen developing in Java, make sure that you have a controlled development environment. To avoid class conflicts and other problems that can be difficult to diagnose, you need to be aware of all of the environment settings that you use during development.The CLASSPATH environment variable is very important as it is used by the java and javac commands to locate the Java classes that are required to run applications and compile source files. It is imperative that CLASSPATH contains the appropriate classes for compiling and running your applications.
This section discusses the use of the setExamplesEnv
shell script to ensure that CLASSPATH and other environment variables are
set properly and consistently for your development shell.
A development shell is a command-line shell that you create for the purpose
of compiling and running the examples shipped with WebLogic or for your own development.
To be certain that this shell has the appropriate
environment variable settings, run the setEnv
script within the shell.
A script for setting up your development shell is included in the config/examples directory of your WebLogic distribution. There are two versions of the script. The one that you have will depend on which platform you have installed WebLogic Server:
Running the script will set up environment variables for compiling and running the examples. To run the script, cd to the config/examples directory and execute the command: $ setExamplesEnv.cmdon Windows NT/2000 or: $ . setExamplesEnv.shin a UNIX bourne shell. The ". " ensures that the variables set by setExamplesEnv are retained by the command shell after the script is run. What setExamplesEnv doessetExamplesEnv sets the following environment variables in your development shell:
CLASSPATHsetExamplesEnv sets CLASSPATH in your development shell to include all of the classes necessary to compile and run the examples.
The script overwrites anything that is currently in CLASSPATH. If you would like to run other Java applications or tools from within your development shell, you must edit the set CLASSPATH command in the setExamplesEnv script to include any classes that these applications may require. Target VariablessetExamplesEnv sets three target variables: CLIENT_CLASSES, SERVER_CLASSES, and EX_WEBAPP_CLASSES. These variables point to directory locations and can be used in conjunction with the -d option of the javac command to place the resulting compiled class in the appropriate directory.Under the /config/examples directory in the WebLogic distribution, you will find directories intended for storing the classes generated when you build the examples shipped with WebLogic. These directories are:
The syntax for accessing environment variables is different between Windows NT/2000 and UNIX. For Windows NT/2000, variables are accessed by bracketing the variable name with "%" characters as shown below: $ javac -d %CLIENT_CLASSES% Client.javaFor UNIX, variables are accessed by preceding the variable name with the "$" character as shown below: $ javac -d $CLIENT_CLASSES Client.javaBoth of the commands above result in the compiled class being placed in the config/examples/clientclasses directory of the WebLogic distribution.
If you will be using a Type 2 JDBC driver in a three-tier architecture, also modify the PATH (as described above) you use to start WebLogic Server.
$ buildOn UNIX, build scripts are named build.sh and can be executed in a bourne shell by changing to the directory containing the build script and running the command: $ sh build.sh
Using Shell ScriptsA configuration file containing the configuration attributes for all of the examples is located at config/examples/config.xml in the WebLogic Server distribution. The startExamplesServer shell script ( .cmd for Windows NT/2000 or .sh for UNIX bourne shell) set up the proper CLASSPATH for the server and will load the examples configuration file by setting the weblogic.Domain property to "examples". These shell scripts are located in the config/examples directory. To run these scripts, cd to the config/examples directory and execute the command:$ startExamplesServer.cmdon Windows NT/2000 or: $ sh startExamplesServer.shin a UNIX bourne shell. The server will start under the "system" identity. The password.ini file located in the config/examples directory contains the password for the system indentity, "examplesPassword", and will be automatically read by the server when it boots. If the password.ini file is removed from this directory, you will be prompted for a password when booting the server. If prompted, enter "examplesPassword". Using the Windows Start MenuOn Windows NT/2000, you can also start the WebLogic Server with the examples configuration from the Windows Start Menu.
http://hostname:port/consolewhere:
![]()
This can happen, if you're browser is set up to access all URLs through a proxy server.
If the machine running WebLogic Server is not registered with the proxy server, you will receive
a URL failure from your browser. To fix this, you can either configure your browser to either not use the
proxy server or to not go through the proxy server accessing an address that begins with the name of the
machine running WebLogic Server.
|
|
Copyright © 2000 BEA Systems, Inc. All rights reserved.
|