Friday, July 22, 2011

Class Loader in weblogic

The class loading hierarchy in the weblogic will be
System -- where commanenv and setdomain env will be called
Domain -- where the domain/.lib libraries will be loaded.
Application -- where application specific jar will be loaded. The root class loader was application loader for an application,
WebApp -- for particular to webapplication. web-inf/lib

So in order to deploy only webapplication without ejb we can inform classloaders to load particular jars in the .xml with the tag <prefer-application-package> from 10.3.4. before <prefer-web-inf-package>. so it will load the classes from web-inf.

We have one good feature in 10.3.4 called FilteringClassLoaders which overrides the classes loaded by weblogic server allowing you to use your libraries.

we have one feature in 10.3.4 Classloader analysis tool -- which check the class conflicts and classpath conflicts. we can also find where the conflict was and help us to resolve the conflict.

we can get the Analysing tool by adding wls-cat at the end of the url of console.

http://www.oracle.com/technetwork/middleware/weblogic/overview/index.html


Thursday, July 21, 2011

How to install patches in weblogic


Installing a Service Pack Upgrade Using Graphical Mode
Follow these steps to download and install a service pack or rolling patch in graphical mode on UNIX and Windows systems:
  1. Download the service pack upgrade installer specific to your platform from the BEA Customer Support Web site at http://support.bea.com.
Note: You will need to log in using your eSupport username and password to download a service pack or rolling patch. If you do not have an eSupport account, you can register for one on the BEA Customer Support Web site.
  1. Start the upgrade installer as described in Table 6-2:
Table 6-2 Starting an Upgrade Installer in Graphical Mode
To start the upgrade installer on this platform . . .
Perform the following steps . . .
Windows
1. Go to the directory where you downloaded the installation program and double-click filename.exe, where filename.exe is name of the installation file you downloaded from the BEA Customer Support Web site, for example, serverXXX_upgrade_win32.exe.
The installation program begins to install the upgrade.
2. Proceed to step 3 below this table.
UNIX
For installers with filenames ending in .bin
1. Go to the directory where you downloaded the installation program and invoke the installation procedure by entering the following commands:
chmod a+x filename.bin
./filename.bin
where filename.bin is the name of the upgrade installation program you downloaded from the BEA Customer Support Web site, for example serverXXX_upgrade_solaris.bin.
The installation program begins to install the upgrade.
2. Proceed to step 3 below this table.
For installers with filenames ending in .jar
1. Include the bin directory of the JVM at the beginning of the PATH variable on the target system. For example:
PATH=JAVA_HOME/bin:$PATH
export PATH
where JAVA_HOME is the full path to the JVM directory.
2. Go to the directory where you downloaded the installation file and launch the installation program by entering the following command:
java -jar filename.jar
where filename.jar is the name of the upgrade installation program you downloaded from the BEA Customer Support Web site, for example pj_serverXXX_upgrade_generic.jar.
The installation program begins to install the upgrade.
3. Proceed to step 3 following this table.

 
  1. Review the text in the Welcome window and click Next.
The Choose BEA Home Directory window is displayed.
Note: You may cancel the installation at any time by clicking Exit.
  1. Select the BEA Home directory containing the release of WebLogic Server you want to upgrade and click Next.
The Confirm Product Directory window is displayed, which includes the path to the BEA home directory and to the directory in which the WebLogic Server software will be updated.
  1. Click Next.
A progress window is displayed during the upgrade installation. When the installation is finished, the Installation Complete window is displayed.
  1. Click Done on the Installation Complete window to exit the installation program.
Installing a Service Pack Upgrade Using Console Mode
Follow these steps to download and install a service pack or rolling patch in console mode on UNIX and Windows systems:
Note: The sample console text and directory pathnames in this section use UNIX conventions (forward slashes) in pathnames, for example, /home1/bea/weblogicXXX. When entering pathnames on a Windows system, use the Windows convention (backward slashes) for pathnames, for example c:\bea\weblogicXXX.
  1. Download the service pack upgrade installer specific to your platform from the BEA Customer Support Web site at http://support.bea.com.
Note: You must log in using your eSupport username and password to download a service pack or rolling patch. If you do not have an eSupport account, you can register for one on the BEA Customer Support Web site.
  1. Start the upgrade installer as described in Table 6-3:
Table 6-3 Starting an Upgrade Installer in Console Mode
To start the upgrade installer on this platform . . .
Perform the following steps . . .
Windows
1. Open an MS-DOS command prompt window.
2. Go to the directory where you downloaded the installation program and invoke the installation procedure by entering the following command:
filename.exe -mode=console
where filename.exe is name of the installation file you downloaded from the BEA Customer Support Web site, for example, serverXXX_upgrade_win32.exe.
The upgrade installer begins to install the WebLogic Server maintenance release.
3. Proceed to step 3 following this table.
UNIX
For installers with filenames ending in .bin
1. Go to the directory where you downloaded the installation program and invoke the installation procedure by entering the following commands:
chmod a+x filename.bin
./filename.bin -mode=console
where filename.bin is the name of the upgrade installation program you downloaded from the BEA Customer Support Web site, for example serverXXX_upgrade_solaris.bin.
The installation program begins to install the upgrade.
2. Proceed to step 3 following this table.
For installers with filenames ending in .jar
1. Include the bin directory of JVM at the beginning of the PATH variable on the target system. For example:
PATH=JAVA_HOME/bin:$PATH
export PATH
where JAVA_HOME is the full path to the JVM directory.
2. Go to the directory where you downloaded the installation file and launch the installation program by entering the following command:
java -jar filename.jar -mode=console
where filename.jar is the name of the upgrade installation program you downloaded from the BEA Customer Support Web site, for example pj_serverXXX_upgrade_generic.jar.
The installation program begins to install the upgrade.
3. Proceed to step 3 following this table.

 
Note: To create a verbose log file during installation, include the -log=/full_path_to_log_file option in the command line.
For example:
serverXXX_upgrade_solaris.bin -mode=console -log=/home/bea/logs/server_install.log
The path can be to a file or folder. All folders in the path must exist before you execute the command or the installation program will not create the log file.
  1. At the Welcome prompt, type next or press Enter to continue with the installation process.
The Choose BEA Home directory prompt is displayed.
  1. Select the BEA Home directory associated with the installation of WebLogic Server that you want to update. If you have only one installation of WebLogic Server installed on the current machine, only one BEA Home directory is listed. For details about the BEA Home directory, see BEA Home Directory.
The installation program displays the following prompt:
Choose BEA Home Directory:
->1| /nfs/home/user1/bea1

  2| /nfs/home/user1/bea2
Enter index number to select OR [Exit][Previous][Next]>
Press Enter to use the selected BEA Home directory or type the number of the BEA Home directory that you want to select.
Whether you accept the selected BEA Home directory or select a different BEA Home directory, you are prompted to confirm your selection, as shown in the following example:
Choose BEA Home Directory:





   ->1¦ Yes, Use this BEA home directory [/nfs/home/user1/bea1]

     2¦ No, return to BEA home directory selection



Enter index number to select OR [Exit][Previous][Next]>
Type 1 or press Enter to accept your selection. Otherwise, type 2 to return to the Choose BEA Home Directory panel where you can modify your entry.
The Confirm Product Directory panel is displayed.
  1. The Confirm Product Directory panel indicates the folder in which the WebLogic Server software will be updated. For example:
Confirm Product Directory:
    Product Installation Directory: [/nfs/home/user1/bea1/weblogicXXX]
Files in /nfs/home/user1/bea1/weblogicXXX will now be upgraded to the X.X.X.X maintenance level.
Enter [Exit][Previous][Next]>
Press Enter or type next to continue.
  1. After you confirm the product directory, the installation program makes a backup copy of specific files from the previous installation and then installs new versions of the files.
When the installation is complete, the following prompt is displayed:
Install Complete
Congratulations! WebLogic Platform X.X.X.X

has been successfully installed to

/nfs/home/user1/bea1/weblogicXXX.
Press any key to continue OR [Exit]>
  1. Press any key to exit the installation program.




http://download.oracle.com/docs/cd/E13222_01/wls/docs81b/install/instsp.html

Tuesday, July 19, 2011

Xargs Commands

http://en.wikipedia.org/wiki/Xargs

xargs -0  The above command uses GNU specific extensions to find and xargs to separate filenames using the null character; -- to grep the filename even with the null charecter.


Xargs -r cp/vi if there is no file, if you use -r then it wont supply any files to cp/vi.



find . -name "*.foo" -print0 | xargs -0 -I {} mv {} /tmp/trash
The above command uses -I to tell xargs to replace {} with the argument list. Note that not all versions of xargs supports the {} syntax. In those cases you may specify a string after -I that will be replaced, e.g.

find . -name "*.foo" -print0 | xargs -0 -I xxx mv xxx /tmp/trash
The above command uses string xxx instead of {} as the argument list marker.

Tuesday, December 28, 2010

Pack & UnPack

BEA provides several tools for creating domains and templates: the Configuration Wizard, the Domain Template Builder, WLST Offline, and the pack and unpack commands. The pack and unpackcommands provide a simple, one-step method for creating domains and templates from the command line. They do not, however, allow you to customize the contents of your domain or template in the same way as the other tools.


The command is residding at wlserver/common/bin


Although the pack command does not allow you to customize the contents of your template in the same way as the Domain Template Builder, it is a useful tool for quickly creating the following:

  • A domain template that contains a snapshot of an entire working domain that has been customized through the Administration Console, Configuration Wizard, or WebLogic Scripting Tool (WLST). This template can then be used to create a domain using unpack, the Configuration Wizard, or WebLogic Scripting Tool (WLST) Offline.
  • A Managed Server template that contains a subset of the files in a domain that are required to create a Managed Server domain directory hierarchy on a remote machine. You can then useunpack to create the Managed Server domain directory on the remote machine.  
About Domain and Managed Server Templates: The term template refers to a Java Archive (JAR) file that contains the files and scripts required to create a domain

  • Domain template—defines the full set of resources within a domain, including infrastructure components, applications, services, security options, and general environment and operating system options. Using the pack command, you can create a domain template from an existing domain. A domain template is used to create a new domain.
  • Managed Server template—defines the subset of resources within a domain that are required to create a Managed Server domain directory on a remote machine. You create a Managed Server template using the pack command, with the -managed=true option. Subsequently, when you use the Managed Server template with the unpack command, the Managed Server domain directory that is created contains sufficient bootstrap information to start the Managed Server on the remote machine. You can start the Managed Server on the remote machine in either of two ways: using Node Manager, or using customized start scripts created when you unpacked the template on the remote machine.


pack

The pack command creates a template archive (.jar) file that contains a snapshot of either an entire domain or a subset of a domain. You can use a template that contains a subset of a domain to create a Managed Server domain directory hierarchy on a remote machine.
The following table describes the files and directories that are included in both domain and Managed Server templates.
When you create this type of template . . .
The following occurs . . .
Domain
All files and directories in the source domain are included, with the following exceptions:
  • Temporary files that are created when you start a server.
  • The servers directory.
  • Files in the security directory that are created automatically when you create the domain, such as DefaultAuthenticatorInit.ldift andXACMLRoleMapperInit.ldift.
Note:If you configured additional security data, such as for users, groups, or roles, through the WebLogic Server Administration Console or other online tools, the security data is stored in the LDAP server and is not included in the template. You must first export the data and then import it into the target domain.
Managed Server (using the -managed=trueoption)
The following files and directories are included by default:
  • All files in the root directory with the following extensions: .cmd, .sh, .xml, .properties, and.ini.
  • Any files with the.pem extension defined in the SSL configuration for your domain
  • bin directory
  • lib directory
  • All files and subdirectories in the config directory
The following files and directories are not included in a Managed Server template by default:
  • Applications and certain application initialization files
  • Temporary files that are created when you start a server
  • The servers directory
  • Files in the security directory that are created automatically when you create the domain, such as DefaultAuthenticatorInit.ldift andXACMLRoleMapperInit.ldift.
Note:The config.xml file of the domain from which you are creating your template must contain Managed Server definitions that specify the IP address and port for the target remote machine. The Managed Server template that you create from that domain can only be used, with the unpack command, on the specified remote machines to create Managed Server domain directories for the Managed Servers defined in the config.xml file.

Example

Executing the following command using a domain named mydomain in the directory C:\bea\user_projects\domains creates a template file named mydomain.jar in the directoryC:\bea\user_templates. The name of the template is specified as My WebLogic Domain.

pack -domain=C:\bea\user_projects\domains\mydomain
-template=C:\bea\user_templates\mydomain.jar -template_name="My WebLogic Domain"

unpack

Creates a full domain or a subset of a domain used for a Managed Server domain directory on a remote machine. You may use unpack only with a template compatible with your current installation. The template can be any of the following:
  • A domain template provided by BEA and packaged with your current installation
  • A domain template created using the Domain Template Builder or WLST Offline
  • A domain template created using the pack command
  • A Managed Server template created using the pack command. A Managed Server template, by default, contains only the files necessary for creating a Managed Server domain directory.
When you use the unpack command with a domain template, it creates a domain containing all of the application and resource files defined in the template. It also creates necessary start scripts, and certain security and configuration files.
When you use the unpack command with a Managed Server template, it creates a Managed Server domain directory that includes the following:
  • A customized start script for each Managed Server in the domain
  • A config_bootstrap.xml file (based on the config.xml in the template)
  • A nm_password.properties file
  • A SerializedSystemIni.dat file
An entry for the Managed Server domain directory is also created in the NM_HOME/nodemanager.domains file, where NM_HOME designates the Node Manager installation directory for the product installation on the remote machine. By default, this directory is located in WL_HOME/common/nodemanager, for example, C:\bea\weblogic92\common\nodemanager\nodemanager.domains.

Note:By default, application files are not included in a Managed Server template created using the pack command. If an application in the domain from which you created a Managed Server template was deployed using external_stage mode, the Managed Server domain directory that you create with the unpack command will not contain any of the external_staged applications. Before you start the Managed Server, you will need to make sure that it has access to the externally staged application files. For more information, see Controlling Deployment File Copying with Staging Modes in Deploying Applications to WebLogic Server.

Example

Executing the following command using a template named mydomain.jar in the directory C:\bea\user_templates creates a domain named my_new_domain in the directoryC:\bea\user_projects\domains.
unpack -template=C:\bea\user_templates\mydomain.jar -domain=C:\bea\user_projects\domains\my_new_domain
Use pack to Create a Managed Server Template
You create a Managed Server template by executing the pack command, with the -managed=true option, on an existing domain that already includes the definition of one or more Managed Servers. This domain must also contain Managed Server definitions in the config.xml file.
  1. From the command line on the local machine (that is, the machine that contains the Administration Server and the definition of Managed Servers), navigate to the WL_HOME\common\bindirectory. In this pathname, WL_HOME is the product directory in which you installed WebLogic Server.
  2. Execute the following command:
  3. pack -managed=true -domain=domain
    -template=template.jar -template_name="template_name"
    
    In this command line:
    • domain—The full or relative path to the domain from which the template is to be created.
    • template.jar—The full or relative path to the template, and the filename of the template to be created.
    • template_name—Descriptive name for the template enclosed in quotes.
    • For example, executing the following command creates a Managed Server template named mydomain_managed.jar from a domain named mydomain.
      pack -managed=true -domain=C:\bea\user_projects\domains\mydomain
      -template=C:\bea\user_templates\mydomain_managed.jar
      -template_name="My Managed Server Domain"
Use unpack to Create a Managed Server on a Remote Machine
  1. Install WebLogic Server on each machine that you want to host a Managed Server for the domain.
  2. Note:All WebLogic Server instances within a domain must run the same version of the WebLogic Server software. For more information about installing WebLogic Server, see the Installation Guide.
  3. Establish a session with the remote machine that will host the Managed Server. You may use any valid method, such as telnet, to do so.
  4. Note:The IP address and port number of the remote machine must match the definition of the Managed Servers specified in the Managed Server template.
  5. Copy the Managed Server template to the remote machine. For details about how to create a Managed Server template, see How Do I: Use pack to Create a Managed Server Template.
  6. On the remote machine, navigate to the WL_HOME\common\bin directory. In this pathname, WL_HOME is the product directory in which you installed WebLogic Server.
  7. Execute the following command, using the Managed Server template that you copied to the machine in Step 3.
  8. unpack -domain=domain -template=template.jar
    
    In this command line:
    • domain—The full or relative path to the domain to be created.
    • template.jar—The full or relative path to the template from which the domain is to be created.
    • For example, executing the following command using a template named mydomain_managed.jar creates a domain named myManagedDomain.
      unpack -domain=C:\bea\user_projects\domains\myManagedDomain
      -template=C:\bea\user_templates\mydomain_managed.jar

 Start Managed Servers on a Remote Machine

When you create a domain directory for Managed Servers using the unpack command, it contains a customized start script for each Managed Server targeted to the current remote machine. For example, if you create a domain that contains two Managed Servers, my_managed_server1 and my_managed_server2, and you target the servers to machine m1, when you create the Managed Server domain directory on machine m1, four custom start scripts are created: startmy_managed_server1.cmd/startmy_managed_server1.sh andstartmy_managed_server2.cmd/startmy_managed_server2.sh. You can use these scripts to start the corresponding Managed Servers. Alternatively, you can use the startManagedWebLogicscript with the required parameters.
  1. Start the Administration Server for the domain as described in Starting and Stopping Servers in Managing Server Startup and Shutdown.
  2. On the remote machine, navigate to the directory for the domain that you created in How Do I: Use unpack to Create a Managed Server on a Remote Machine.
  3. Start the Managed Server on the remote machine by doing one of the following:
    • On a Windows system, open an MS-DOS command prompt window and enter one of the following at the prompt:
    • startmy_managed_server
      startManagedWebLogic my_managed_server admin-url
    • On a UNIX system, enter one of the following at the prompt:
    • ./startmy_managed_server.sh
      ./startManagedWebLogic.sh my_managed_server admin-url
      In these command lines, my_managed_server is the name of the Managed Server to be started and admin-url specifies the listen address (host name or IP address) and port number of the machine hosting the Administration Server. For your convenience, the startManagedWebLogic_Readme.txt file provides a list of all the Managed Servers and the admin-url for the domain. http://download.oracle.com/docs/cd/E13179_01/common/docs92/pack/tasks.html