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.