Tuesday 4 February 2014

Configuring and Starting Oracle Weblogic Admin Sever as Service

We can configure the Admin server and Managed Server's as a service follow the below steps:

Create a text file and save it as Admin.cmd file. We need to set the below variables in the file and some of them are optional.

DOMAIN_NAME: Your domain name

USERDOMAIN_HOME": Obsolute path of the domain in the system

SERVER_NAME: Name of the Admin Server

PRODUCTION_MODE: If the server is in production mode set the value to 'true'

WLS_USER: Weblogic server user name ( if the authentication is set)

WLS_PW: password

ADMIN_URL: Admin server url

JAVA_VENDOR: Sun

JAVA_HOME: Set the JAVA home value

MEM_ARGS: Memory setting's for the server

call "C:\Oracle\Middleware\Oracle_Home\wlserver\server\bin\installSvc.cmd"

(you need to run the install service command, which will be located in the 'wlserver\server\bin' path

The file should look like below:

----------
echo off
SETLOCAL
set DOMAIN_NAME=NodeDomain
set USERDOMAIN_HOME=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\NodeDomain
set SERVER_NAME=AdminServer
set PRODUCTION_MODE=true
set WLS_USER=weblogic
set WLS_PW=Venkat1984
set JAVA_VENDOR=Sun
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45
set ADMIN_URL=http://localhost:7001
set MEM_ARGS=-Xms256m -Xmx256m
call "C:\Oracle\Middleware\Oracle_Home\wlserver\server\bin\installSvc.cmd"
ENDLOCAL
--------

Save the file.

Run the 'Admin.cmd' as an Administrator, if not you may get the error.

OpenSCManager failed - Access is denied. (0x5)

Now run the 'Services.msc'. you can see the weblogic admin server created as a service.


Start the service with the command:

In the path (generic) execute the command:

C:\Oracle\Middleware\Oracle_Home\wlserver\server\bin>wlsvc -debug "service name"

 "service name" should be name of your service created

Access admin server with the console url





Sunday 2 February 2014

How to set or change the session timeout value in Oracle Weblogic Server

1) Login into the Admin console and go to left pane click on 'Lock & Edit'

Navigate to YourDomain--> Deployments

Click on the deployed war file

Go to the 'çonfiguration' tab and change the 'Session Timeout (in seconds):' value

This value will be for the application session interval. Please find the below screenshot. In this example, the deployed .war file is 'benefits'.






Once you change this value the value will be set in the 'weblogic.xml' file. Open the file, you can find the below lines.
<session-descriptor>
    <timeout-secs>180</timeout-secs>
    <invalidation-interval-secs>180</invalidation-interval-secs>
</session-descriptor>
Alternatively you can even change the 'timeout-secs' value in the 'weblogic.xml' and re-start the server. Your changed will be reflected.

2) You can also set the session timeout value in the web.xml file as below.

<session-config>
  <session-timeout>60</session-timeout>
</session-config>
 If you set two different values in web.xml and weblogic.xml, the web.xml file is given more preference and it will be considered by the server.

What is Invalidation Interval ?

The time (in seconds) that WebLogic Server waits between doing house-cleaning checks for timed-out and invalid sessions, and deleting the old sessions and freeing up memory.

Thursday 30 January 2014

How to solve the 'Cannot load driver: org.postgresql.Driver', error while configuring data source

In Oracle Weblogic Server, when we configure the Data Source with Postgresql database we may get the error 'Cannot load driver: org.postgresql.Driver'  in the admin console while testing the connection. In Admin log you can find the below log:
<BEA-240003> <Administration Console encountered the following error: java.lang.ClassNotFoundException: Cannot load driver: org.postgresql.Driver
Solution:
  • Download the 'postgresql-8.4-701.jdbc3' or relative postgresql jar file from web.
  • Copy and paste the .jar file in 'C:\Oracle\Middleware\Oracle_Home\wlserver\server\lib'
  • (according to your weblogic server installation)
  • Set the CLASSPATH to the above location in the Environment variables in windows
  • If it is UNIX set the path to 'LD_LIBRARY_PATH' variable
  • Restart the Admin and Managed server's
  • Now test the connection, it will work

Tuesday 28 January 2014

How to configure Oracle Weblogic server with Apache HTTP Server

Configuring Oracle Weblogic server with Apache HTTP Server (Web Server):

Ensure that you have already installed the Apache HTTP Server and it is in shutdown mode.

Download the WLS Web Server Proxy Plug-In for Apache HTTP Server from My Oracle Support (http://support.oracle.com).

The plugin package will be in the form of Zip file. For example for Windows 64 bit, it will be like 'WLSPlugin12c-64bit-Apache2.2-Apache2.4-win64-x86_64.zip'

Steps to Install and configure the Apache Http server plug-in:

1) Once you extract the plug-in file, set the weblogic-plugins-12.1.2/lib folder to the 'PATH' in Windows and 'LD_LIBRARY_PATH' in UNIX.
   Here you are setting the PATH to the weblogic plug-ins lib folder.

2) In the plug-in's extracted path, locate the lib/mod_wl.so, or lib\mod_wl.dll for windows.

3) Open the httpd.conf located in \\Apache2\conf folder (take a backup of this file).

4) Load the Apache HTTP Server plug-in module for Apache 2.2.x by adding the belowline. For Windows, specify the .dll file

   LoadModule weblogic_module /home/myhome/weblogic-plugins-12.1.2/lib/mod_wl.so (for Unix)

   LoadModule weblogic_module /home/myhome/weblogic-plugins-12.1.2/lib/mod_wl.dll (for Windows)

5) Configure the WebLogicHost and WebLogicPort parameters for non-clustered WebLogic Server. Add the IfModule as below in the httpd.conf file.
<IfModule mod_weblogic.c>
 WebLogicHost localhost
 WebLogicPort 7001
 DebugConfigInfo ON
</IfModule>
6) Configure the WebLogicCluster parameter for clustered WebLogic Servers. Add the IfModule as below in the httpd.conf file.
<IfModule mod_weblogic.c>
 WebLogicCluster localhost:7001,localhost1:w1s2.com:7001,localhost2:7001
</IfModule>
7) Now save the httpd.conf file and start the Apache http server, the plugin will be loaded to the server.

There are many other plug-in parameters, which we can configure based on our requirement.

Wednesday 22 January 2014

How to change Node Manager port in Oracle WebLogic Server

Some times when you try to start a managed server with node manager it may fail with the below error ín the 'nodemanager' log file saying that 'port 5,556: java.net.BindException: Address already in use: JVM_Bind>'' which means the specific port '5556' is already binded and is in use by some other process. 
<23 Jan, 2014 6:25:56 AM IST> <SEVERE> <The server is unable to create a server socket for listening. The address localhost might be incorrect or another process is using port 5,556: java.net.BindException: Address already in use: JVM_Bind>
Now you need to change the node manager port to some other port number to avoid theport conflict error. Please follow the below steps:

1) Go to nodemanager.properties file located in yourdomainname\nodemanager

Generic Path: C:\Oracle\Middleware\Oracle_Home\user_projects\domains\NodeDomain\nodemanager

Open the nodemanager.properties file and change the 'Listen Port' value to some other port which is not used.

2) Then login into the Weblogic Admin Console on the left pane yourDomainName --> Environment --> Machines

Click on the Machine name which is configured for the relative managed server. 

Click on 'Node Manager' and the on 'Lock and Edit' on the left pane

Change the 'Listen port' then Save and click on 'Release Configuration'

 Now no more re-starts are necessary. You can even monitor the node manager status from console by clicking on 'Monitoring' here.

Friday 17 January 2014

Generating Verbose Log File during Installation

What is Verbose log ?

The log that stores messages (informational, warning, error, and fatal) about events that occur during the installation process

How to generate the Verbose log ?

 
If you launch the installation from the command line or from a script, you can specify the -log option to generate a verbose installation log. The installation log stores messages (informational, warning, error, and fatal) about events that occur during the installation process. This type of log mechanism can be especially useful for silent installations.

To create a verbose log file during installation, include the -log=full path to log file option in the command line.

For example, to create a verbose log file for the WebLogic Server Package installer for Windows:

wls_win32.exe -log=C:\logs\server_install.log
The path must specify a file and folder which should be existing, the application will not create the folder or the file.

Thursday 16 January 2014

Pack and Unpack Command in Oracle Weblogic Server with Example

If you want to make use of an existing domain configuration while creating a new domain you can make use of pack and unpack commands.  The pack command creates a template .jar archive file that contains entire WebLogic domain or a subset of a WebLogic domain.
In the sense 'Pack' command will create a template on top of the existing domain.

pack command will be located in the generic path


 'C:\Oracle\Middleware\Oracle_Home\wlserver\common\bin' 
pack.cmd (windows)
pack.sh (unix)
Syntax:
pack -domain=domain -template=template -template_name="template_name"
The below parameters are optional: 
[-template_author="author"][-template_desc="description"] [-managed=true|false] [-log=log_file] [-log_priority=log_priority]

It is suggested to keep the log parameter, such that you can find the if any errors in creating the template

Example:

pack -domain=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp -template=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar  -template_name="TempDom" -template_author="King" -template_desc="Temp Domain Template" -managed=true -log=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\tempdom.log
Remember the while giving the template name it should be added with 'jar' extension. This will create the 'Temp.jar' in the location C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp

The unpack command will create a full WebLogic domain or a subset of a domain that is used for a Managed Server domain directory on the target machine.

unpack -template=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar -domain=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\mynewdomain

Sntax:
unpack -template=template -domain=domain
The below parameters are optional:

[-user_name=username] [-password=password] [-app_dir=application_directory] [-java_home=java_home_directory] [-server_start_mode=dev|prod] [-log=log_file] [-log_priority=log_priority] [-overwrite_domain]

Example:

unpack -template=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar -domain=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\unpackedDomain
This command will create a new domain called 'unpackedDomain' in the path C:\Oracle\Middleware\Oracle_Home\user_projects\domains\
 
Sample log of the pack command:

2014-01-16 22:45:36,266 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - read domain from "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp"
2014-01-16 22:45:45,600 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - succeed: read domain from "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp"
2014-01-16 22:45:45,602 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - set config option Managed to "true"
2014-01-16 22:45:45,698 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - succeed: set config option Managed to "true"
2014-01-16 22:45:45,699 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - write template to "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar"
2014-01-16 22:45:47,589 INFO  [Thread-2] com.oracle.cie.domain.TemplateGenerator - Template Generation Successfull!
2014-01-16 22:45:47,604 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - succeed: write template to "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\Temp\Temp.jar"
2014-01-16 22:45:47,604 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - close template
2014-01-16 22:45:47,605 INFO  [runScript] com.oracle.cie.domain.script.ScriptExecutor - succeed: close template

How to start the Coniguration Wizard and Create/Update a Domain from Graphical Mode

Windows:

Go to the Start --> Programs --> Oracle --> OracleHome --> WebLogic Server 12c (12.1.2) --> Tools --> Coniguration Wizard


else

Double click on the 'config.cmd' located in the generic path:

C:\Oracle\Middleware\Oracle_Home\wlserver\common\bin 


UNIX:

Execute the shell script 'config.sh' in the same path mentioned above.

Ensure the script has execute permissions.

The below screen will pop-up and you can proceed with the domain creation or update the existing domain configuration



Wednesday 15 January 2014

How to change admin server port in Oracle Weblogic Server

There are two ways, where you can change the Admin server port specific to the domain.

1) Editing the 'config.xml' file

Go to the domain specific 'config' directory and edit the çonfig.xml file.  This file will contains the complete configuration details of the servers, machines, port..etc

Ex: C:\Oracle\Middleware\Oracle_Home\user_projects\domains\TestDomain\config

Find the below code

 <server>
    <name>AdminServer</name>
    <ssl>
      <name>AdminServer</name>
      <enabled>false</enabled>
      <listen-port>7006</listen-port>
    </ssl>
    <listen-port>7001</listen-port>
    <listen-address>localhost</listen-address>
  </server>

Here 7001 is the admin server port of the domain. Now changed it to the required port and re-start the server and access the Admin console with the new port.

2) From the Admin console preferences:

Login in into the Admin console.

Click on the "Lock & Edit" button on the left pane. This is to edit the configuration's in the console.



Navigate to Environment --> Servers --> admin server

Click on Admin Server

Go to the 'Çonfiguration' tab

Change the ''Listen Port:' value. Re-start is not required for this kind of change.




The best and suggested way is to change the port from the Admin server console preference through the GUI.

Tuesday 14 January 2014

Graphical Mode Installation of Oracle Weblogic Sever using '.bin' file on UNIX Machines

og in to the UNIX system

Navigate to the directory that contains the installation .bin file.

Launch the server installation by executing the following commands:

    chmod a+x Install_file_name.bin
By this unix command, you are making the file to be executable
    ./Install_file_name.bin
The GUI Screen will pop-up and you can proceed with the installation

Install_file_name.bin is the name of the Weblogic installation file. The installation comes with some server examples, If you want them to be installed you must include the following parameter in the installation command If not, the installation may take more time.

    -Djava.security.egd=file:/dev/./urandom
Note: you should be having administration rights to execute the installation.

Graphical Mode Installation of Oracle WebLogic Server on a 64-bit platform using a .jar file

On Windows System:

Follow the below instructions to set the JAVA PATH, set JAVA_HOME to 64 bit JDK file location.

JAVA_HOME=path_to_64-bit_JDK; export JAVA_HOME

PATH=$JAVA_HOME/bin:$PATH; export PATH
Ensure you are setting the Java path to JDK not to the JRE. Go to the weblogic installation jar file path and execute the below command.
java -Xmx1024m -jar wlsversion_generic.jar
The GUI screen follows and proceed with the installation.

On UNIX or Linux Systems, you need include the -d64 flag in the installation command.

java -d64 -jar wlsversion_generic.jar
Common Errors: 

D:\Weblogic\Install>java -X1024m -jar wls_121200.jar
Error: Invalid or corrupt jarfile wls_121200.jar


This is due to the installation file has got corrupted. Download or copy the fresh jar and proceed with the installation

Types of Oracle Weblogic Installers

Weblogic Installers Types:

OS-specific Package installer: Operating System specific installer is a standalone version of the installation program that includes the JDKs for the selected platform. The installer may be either an .exe file or a .bin file, depending on the selected platform. (.exe for windows and .bin for UNIX and LINUX)

Please note that Silent mode installation is supported only for Package installers.

Generic Package installer: This type of installer is a .jar file. It does not include the JRockit SDK and Sun JDK. You can use tzhis type of installer to install the product on any supported platform on which Java is already installed.

Upgrade installer: This type of installers allow you to upgrade an existing WebLogic Server installation to the current patch release. For example, if you have WebLogic Server 10.3.0 installed, you can use an Upgrade installer to upgrade your installation to WebLogic Server 10.3.6. If a patch release is available for your current WebLogic Server installation, you can download an Upgrade installer from My Oracle Support.

Depending on the platform, the Upgrade installer is either an OS-specific Package installer (.bin or .exe file) or a Generic Package installer (.jar file). Upgrade installers are available only from My Oracle Support.

Development-only and supplemental installers: The development-only installer is a ZIP file that you extract to a Middleware home directory to create a WebLogic Server installation. It contains a WebLogic Server installation that includes all of the artifacts needed for development. You must not use this WebLogic Server installation for production.