The largest Interview Solution Library on the web


« Previous | 1 | 2 | 3 | Next »

Weblogic - WLS ENVIRONMENT AND TOOLS


Development and production environments differ in the way their applications and availability are managed. The environment that most closely resembles the production environment is that of the User Acceptance Test (UAT). With WebLogic Server, it is possible to change the configuration attributes of domain resources dynamically—that is, while servers are running. One of the strongest features is that, in most cases, the WebLogic Server does not have to be restarted for changes to take effect. When an attribute is reconfigured (when the value is changed), the new value is immediately reflected in both the current runtime value of the attribute and the persistent value stored in the XML configuration file.

Setting the classpath Option

To execute various command-line administration tools, you will be required to set the CLASSPATH variable, or the following must be included as values to the -classpath option on the java command line:

/weblogic/lib/weblogic_sp.jar
/weblogic/lib/weblogic.jar

WebLogic Server provides a default database management system (DBMS) called Cloudscape. To use this DBMS, the following needs to be included in classpath setup:

/weblogic/samples/eval/cloudscape/lib/cloudscape.jar

If you will be using WebLogic Enterprise Connectivity, you will need to include the following:

/weblogic/lib/poolorb.jar

where weblogic is the directory in which you installed WebLogic Server. To set the CLASSPATH variable on the command line, specify the following:

SET CLASSPATH=C:\bea\weblogic700b\server\lib\weblogic.jar

Starting WebLogic Server

To start WebLogic Server from the Start menu, choose Programs | BEA WebLogic Enterprise Platform | WebLogic Platform Beta 7.0 | User Domains | My Domain | My Server. Alternatively, follow these steps:

1. Access the command prompt by choosing Start | Run | CMD.
2. Change the working directory to C:\BEA\User_Domains\MyDomain.
3. Run the setenv.bat file on Microsoft Windows platform, or setenv.sh on the UNIX platform. This file internally calls another file from C:\BEA\WebLogic700b\ Server\Bin called startWebLogic.cmd. (StartWebLogic.cmd is the file that declares necessary environment variables. The environment variables specified in startWebLogic.cmd are used by WebLogic Server as input while starting up.) It further assigns few more variables, such as WL_HOME and JAVA_HOME, sets the CLASSPATH, appends PATH for WebLogic Server bin and Java bin folders, and finally executes weblogic.Server. It also makes sure that the weblogic.jar file is available and that CLASSPATH points to it.

Sample startWebLogic.cmd (C:\BEA\User_Domains\MyDomain)

@rem ******************************************************************
@rem This script is used to start WebLogic Server for the domain in
@rem the current working directory. All this script does is set the
@rem DOMAIN_NAME and SERVER_NAME variables, then calls the
@rem startWebLogic.cmd script under %WL_HOME%\server\bin.
@rem
@rem To create your own start script for your domain, all you need to
@rem set is DOMAIN_NAME and SERVER_NAME, then call
@rem %WL_HOME%\server\bin\startWebLogic.cmd
@rem
@rem Other variables that startWebLogic takes are:
@rem
@rem WLS_USER - cleartext user for server startup
@rem WLS_PW - cleartext password for server startup
@rem STARTMODE - true for production mode servers, false for
@rem development mode
@rem JAVA_OPTIONS - Java command-line options for running the server.
@rem (These will be tagged on to the end of the JAVA_VM
@rem and MEM_ARGS)
@rem JAVA_VM - The java arg specifying the VM to run.
@rem (i.e. -server,
@rem -hotspot, etc.)
@rem MEM_ARGS - The variable to override the standard memory
@rem arguments
@rem passed to java
@rem
@rem For additional information, refer to Installing and
@rem Setting up WebLogic
@rem Server (http://e-docs.bea.com/wls/docs70/install/index.html).
@rem ******************************************************************

echo off
SETLOCAL
@rem Set DOMAIN_NAME to the name of the domain you wish to run.
set DOMAIN_NAME=mydomain
@rem Set SERVER_NAME to the name of the server you wish to start up.
set SERVER_NAME=myserver
@rem Set WLS_USER equal to your system username and WLS_PW equal
@rem to your system password for no username and password prompt
@rem during server startup. Both are required to bypass the startup
@rem prompt.
set WLS_USER=installadministrator
set WLS_PW=installadministrator
@rem Set Production Mode. When this is set to true,
@rem the server starts up in
@rem production mode. When set to false, the server starts
@rem up in development
@rem mode. If it is not set, it will default to false.
set STARTMODE=
@rem Set JAVA_OPTIONS to the java flags you want to pass to the vm. i.e
@rem set JAVA_OPTIONS=-Dweblogic.attribute=value -Djava.attribute=value
set JAVA_OPTIONS=
@rem Call WebLogic Server
call "C:\bea\weblogic700b\server\bin\startWebLogic.cmd"

ENDLOCAL

Sample startWebLogic.cmd (Under C:\BEA\WebLogic700b\Server\Bin)

@rem ******************************************************************
@rem This script is used to start WebLogic Server
@rem
@rem To create your own start script for your domain,
@rem all you need to set is
@rem DOMAIN_NAME and SERVER_NAME, then call this script from the domain
@rem directory.
@rem
@rem This script sets the following variables before starting
@rem WebLogic Server:
@rem
@rem WL_HOME - The root directory of your WebLogic installation
@rem JAVA_HOME - Location of the version of Java used to start
@rem WebLogic Server. This variable must point to the root
@rem directory of a
@rem JDK installation and will be set for you by the
@rem installer.
@rem See the WebLogic platform support page
@rem (http://e-docs.bea.com/wls/platforms/index.html) for
@rem an up-to-date list of
@rem supported JVMs on Windows NT.
@rem PATH - Adds the JDK and WebLogic directories to the
@rem system path.
@rem CLASSPATH - Adds the JDK and WebLogic jars to the classpath.
@rem
@rem Other variables that startWebLogic takes are:
@rem
@rem WLS_USER - admin username for server startup
@rem WLS_PW - cleartext password for server startup
@rem ADMIN_URL - if this variable is set, the server started will be
@rem managed server, and will look to the url specified
@rem (i.e. http://localhost:7001) as the admin server.
@rem STARTMODE - set to true for production mode servers, false for
@rem development mode
@rem JAVA_OPTIONS - Java command-line options for running the server.
@rem (These
@rem will be tagged on to the end of the JAVA_VM
@rem and MEM_ARGS)
@rem JAVA_VM - The java arg specifying the VM to run.
@rem (i.e. -server, -client, etc.)
@rem MEM_ARGS - The variable to override the standard
@rem memory arguments passed to java
@rem
@rem jDriver for Oracle users:This script assumes that native libraries
@rem required for jDriver for Oracle have been installed in the proper
@rem location and that your system PATH variable has been set
@rem appropriately.
@rem
@rem For additional information, refer to Installing and Setting up
@rem WebLogic
@rem Server (http://e-docs.bea.com/wls/docs70/install/index.html).
@rem ******************************************************************

@echo off
SETLOCAL
set WL_HOME=C:\bea\weblogic700b
set JAVA_HOME=C:\bea\jdk131
@rem Check that the WebLogic classes are where we expect them to be
:checkWLS
if exist "%WL_HOME%\server\lib\weblogic.jar" goto checkJava
echo The WebLogic Server wasn't found in directory %WL_HOME%\server.
echo Please edit your script so that the WL_HOME variable points
echo to the WebLogic installation directory.
goto finish
@rem Check that java is where we expect it to be
:checkJava
if exist "%JAVA_HOME%\bin\java.exe" goto runWebLogic
echo The JDK wasn't found in directory %JAVA_HOME%.
echo Please edit your script so that the JAVA_HOME variable
echo points to the location of your JDK.
goto finish
:runWebLogic
if not "%JAVA_VM%" == "" goto noResetJavaVM
set JAVA_VM=-hotspot
:noResetJavaVM
if not "%MEM_ARGS%" == "" goto noResetMemArgs
set MEM_ARGS=-Xms200m -Xmx200m
:noResetMemArgs
@echo on
set CLASSPATH=%JAVA_HOME%\lib\tools.jar;
%WL_HOME%\server\lib\weblogic_sp.jar;
%WL_HOME%\server\lib\weblogic.jar;%CLASSPATH%
set PATH=.;%WL_HOME%\server\bin;%JAVA_HOME%\bin;%PATH%
@echo ***************************************************
@echo * To start WebLogic Server, use a username and *
@echo * password assigned to an admin-level user. By *
@echo * default, this is user: installadministrator *
@echo * and password: installadministrator. These *
@echo * should both be changed using the WebLogic *
@echo * Server console at *
@echo * http://[hostname]:[port]/console *
@echo ***************************************************
@rem Start Server
@echo off
if "%ADMIN_URL%" == "" goto runAdmin
@echo on
"%JAVA_HOME%\bin\java" %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -classpath
"%CLASSPATH%" -Dweblogic.Domain=%DOMAIN_NAME%
-Dweblogic.Name=%SERVER_NAME%
-Dbea.home="C:\bea"
-Dweblogic.management.username=%WLS_USER%
-Dweblogic.management.password=%WLS_PW%
-Dweblogic.management.server=%ADMIN_URL%
-Dweblogic.ProductionModeEnabled=%STARTMODE%
-Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy"
weblogic.Server
goto finish
:runAdmin
@echo on
"%JAVA_HOME%\bin\java" %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS%
-classpath "%CLASSPATH%" -Dweblogic.Domain=%DOMAIN_NAME%

-Dweblogic.Name=%SERVER_NAME% -Dbea.home="C:\bea"
-Dweblogic.management.username=%WLS_USER%
-Dweblogic.management.password=%WLS_PW%
-Dweblogic.ProductionModeEnabled=%STARTMODE%
-Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy"
weblogic.Server

:finish

ENDLOCAL

Tools

In this section, we will look at the tools involved in working with WebLogic Server.

Deployment

With Java applications, deployment has never been easy. WebLogic provides various options for deploying applications. Use the WebLogic Server Administration Console, the weblogic.Deployer utility, the Marathon utility, or auto-deployment. The weblogic.Deployer utility is further discussed in Chapter 12.

EJBGen

WebLogic 7 has an EJBGen tool that works as an EJB 2.0 code generator. While executing this tool, you are required to provide the name of a bean class file with javadoc comment tags, which will then generate the remote and home classes and the deployment descriptor files for an EJB application. This helps reduce the number of EJB files to edit and maintain. EJBGen allows editing to be limited to one file (the bean class) and annotated with javadoc tags. EJBGen is discussed further in Chapter 12.

WebLogic Builder

At times, assembling a J2EE application module, creating and editing its deployment descriptors, and later deploying it to WebLogic Server can prove to be a challenging and time-consuming task. WebLogic Builder, as shown in Figure 1-11, facilitates those challenges as a graphical tool used for assembling a J2EE application module, creating and editing its deployment descriptors, and deploying it to a WebLogic server.

WebLogic Builder provides a visual editing environment for editing an application’s deployment descriptor XML files. You can view these XML files as you visually edit them in WebLogic Builder, but you won’t need to make textual edits to the XML files.

Figure 1-11 shows how we have opened and accessed the descriptor files from within the EJB application module (EAR). The open descriptor files are ejb-jar.xml and weblogic-ejb-jar.xml. The changes you make to the descriptors using this tool are saved in the related archive file (JAR or EAR).

WebLogic Workshop

WebLogic Workshop is an integrated development environment (IDE) that offers a GUI-based approach to developing distributed, interconnected, and loosely coupled enterprise-class Web services. With WebLogic Workshop, you can design Web services as you might draw them on paper and then add code to support the services’ functionality. You can focus on developing your service’s application logic rather than on writing code to support platform infrastructure. Figure 1-12 demonstrates the concept.
« Previous | 1 | 2 | 3 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com