Friday, May 27, 2016

Unix Commands


  • chown  -R admin:admin <folder_name>

           To change the ownership of the file systems



Sunday, October 19, 2014

How to install Apache ANT

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications.

How to install Apache ANT ?

Apache ANT is available in both Source and Binary Distribution.

Download the binary distribution  : http://ant.apache.org/bindownload.cgi
Download the source distribution : http://ant.apache.org/srcdownload.cgi

If we download the binary version no need to compile the source and install the ANT
  • Download the binary distribution version from Apache mirrors.
  • If we are using Linux and installed GNU tar installed  download apache-ant-1.9.4-bin.tar.gz
  • Copy to server location and gunzip it  gunzip apache-ant-1.9.4-bin.tar.gz
  • untar the file as tar -xvf apache-ant-1.9.4-bin.tar
  • set the PATH as export PATH=$PATH:/opt/Apache/apache-ant-1.9.4-bin
If we want to set the path permanently , add the below lines in your server profile

      vi .profile
      export PATH=$PATH:/opt/Apache/apache-ant-1.9.4-bin
  • Verify the ANT installation as below
    -bash-3.2$ ./ant -version
    Apache Ant(TM) version 1.9.4 compiled on April 29 2014

Weblogic deployment through wldeploy ant task

There are different types and ways to deploy the applications in weblogic .For more information please go through the link. Different Types of Deployments in Weblogic

How to deploy applications with wldeploy ant task in weblogic ?

Weblogic server provides the wldeploy ant task to perform the deployment operations.The wldeploy Ant task  performs weblogic.Deployer functions using attributes specified in an Ant XML file.

How to use the wldeploy ?

To use the wldeploy ant task , ANT should be installed. Refer the link How to install Apache ANT .
  • Verify the ANT installation as below
               -bash-3.2$ ./ant -version
                Apache Ant(TM) version 1.9.4 compiled on April 29 2014
                -bash-3.2$
  • If you get the error JAVA_HOME error as below 
             -bash-3.2$  ./ant -version
             Error: JAVA_HOME is not defined correctly.
             We cannot execute /opt/java/32bit/jdk1.6.0_31/bin/java
  • Set the JAVA_HOME  as below
            -bash-3.2$ export JAVA_HOME=/opt/install/java/32bit/jdk1.6.0_31
            -bash-3.2$ echo $JAVA_HOME
            /opt/install/java//32bit/jdk1.6.0_31
  • Create the build.xml as below
           <project name="weblogic_deployment" default="deploy">
           <target name="deploy">
              <wldeploy
                      action="deploy" verbose="true" debug="true"
                      name="example-App" source="/opt/data/applications/example-App.war"
                      user="weblogic-user" password="weblogic-password"
                      adminurl="t3://weblogic-admin-host:7001" targets="server-name"  />
              </target>
             </project>
  •  Set the weblogic environment variables , otherwise will get the below type of error.
    -bash-3.2$ ./ant deploy
        Buildfile: /opt/data/ant/apache-ant-1.9.4/bin/build.xml
       deploy:
       BUILD FAILED
       /opt/data/ant/apache-ant-1.9.4/bin/build.xml:8: Problem: failed to create task or type wldeploy
       Cause: The name is undefined.
       Action: Check the spelling.
       Action: Check that any custom tasks/types have been declared.
       Action: Check that any <presetdef>/<macrodef> declarations have taken place.
       Total time: 0 seconds
  • Set the weblogic domain environment variables as below 
          -bash-3.2$ . /opt/weblogic/domain/weblogicdomain/bin/setDomainEnv.sh
           Note: Here /opt/weblogic/domain/weblogicdomain is weblogic domain home
  • Run the ant script as 
           -bash-3.2$ ./ant deploy

Issues we may get during the deployment through wldeploy ant task

BUILD FAILED
weblogic.management.ManagementException: [Deployer:149163]The domain edit lock is owned by another session in non-exclusive mode - this deployment operation requires exclusive access to the edit lock and hence cannot proceed. If you are using "Automatically Aquire Lock and Activate Changes" in the console, then the lock will expire shortly so retry this operation.

Solution 2 : Wait until Lock& Edit available or release the Configuration changes to obtain the lock.

Solution 2 : use the usenonexclusivelock="true" to build.xml to avoid the error.

Note: If we use this option  ant will not through error but gives the warning as 
[wldeploy] [BasicOperation.execute():445] : Initiating deploy operation for app, example-App , on targets:
 [wldeploy] [BasicOperation.execute():447] :    server-name
 [wldeploy] Task 14 initiated: [Deployer:149026]deploy application example-App on server-name.
 [wldeploy] Operation is pending and will be activated or cancelled when the ongoing edit session is activated or cancelled.
  • Once the activate changes done deployment done other wise changes will not reflect.




Wednesday, October 15, 2014

Site Down Maintenance page in iPlanet

When ever your site is going to Schedule Maintenance or Down due to some issues at back end servers. Is it good to show 404 or 500 Page errors to users?. No , in this situation we need to build the custom Site Maintenance pages.

How to configure Site Maintenance Page in iPlanet?
  • Add below configuration lines in obj.conf file
        <Client urlhost="examplesite.com">
                 NameTrans fn="redirect" from="/" url="/Site_Maintenance_Page.htm"
        </Client>
  • Push or Deploy the configuration changes . No need of the server restart.
How to display the site logs or Images in Maintenance Page?
  • If you are using the images or static files to display your site Maintenance page to looks good you may face the problems.

    • How to solve it ?
      • Rewrite your static files as below
    • NameTrans fn="rewrite" from="/Site_Maintenance_Page/site_logo.png" root="/opt/iplanet" path="/Site_Maintenance_Page/site_logo.png"
    • NameTrans fn="rewrite" from="/Site_Maintenance_Page/Site_body.jpg" root="/opt/iplanet" path="/Site_Maintenance_Page/Site_body.jpg" 

 Note: Make sure Rewrite directive configuration should be placed before the redirect directive , other static images or files wont access.
  • Overall Configuration looks like
<Client urlhost="examplesite.com">
           NameTrans fn="rewrite" from="/Site_Maintenance_Page/site_logo.png" root="/opt/iplanet"                 path="/Site_Maintenance_Page/site_logo.png"

            NameTrans fn="rewrite" from="/Site_Maintenance_Page/Site_body.jpg" root="/opt/iplanet"               path="/Site_Maintenance_Page/Site_body.jpg"
            NameTrans fn="redirect" from="/" url="/Site_Maintenance_Page.htm"
</Client>

Tuesday, October 14, 2014

Tomcat Integration with iPlanet Webserver

AJP  (Apache JServ protocol ) is a communications protocol developed by apache.org to facilitate integration of the Tomcat web container with third party web servers. Web server specific AJP plugins have been developed for Apache, IIS and  iPlanet.nsapi_redirector.so Plugin developed to integrate the Tomcat server with iPlanet webserver.

How to Integrate the Tomcat server with iPlanet ?

  • Load the nsapi_redirector.so plugin and worker.properties in magnus.conf file 
Init fn="load-modules" funcs="jk_init,jk_service" shlib="/opt/iplanet//lib/nsapi_redirector.so"
Init fn="jk_init" worker_file="/opt/iplanet/worker.properties" log_level="debug" log_file="/opt/iplanet/nsapi.log"
  • Create the Worker Properties file 
/opt/iplanet/worker.properties
------------------------------------------------
# List of workers for handling incoming requests
worker.list=Worker1
worker.Worker1.host=Tomcat-Host-name.com
worker.Worker1.port=8009
worker.Worker1.type=ajp13
worker.Worker1.cachesize=100
worker.Worker1.lbfactor=1
  • Add NameTran function in obj.conf file
         NameTrans fn="assign-name" from="/Tomcat-app/*" name="Tomcat-app"
        <Object name="Tomcat-app">
            Service fn="jk_service" worker="Worker1"
      </Object>

Note: If you have custom Custom-obj.conf file (Virtual servers) and has client configuration your  Reverse proxy configuration is as below.
Custom-obj.conf
-----------------------------------------------------
<Object name="default">
     <Client urlhost="example-server.com">
          NameTrans fn="assign-name" from="/Tomcat-app/*" name="Tomcat-app"
     </Client>
</Object>

<Object name="Tomcat-app">
         Service fn="jk_service" worker="Worker1"
</Object>

Friday, October 10, 2014

Reverse Proxy configuration in iPlanet Web server

A Reverse Proxy is a type of server that retrieves resources from other servers on behalf of the client. The resources are returned to the client as though they are originated from the server itself. Client feels that the resources are being provided by the server itself, and unaware of the servers that have provided the resources.Forward proxy acts as an intermediary for its clients and returns the resources accessible on the internet.Reverse proxy acts as an intermediary for the servers to return the resources provided by other servers.Reverse proxy is most widely used when you want your application accessible in the internet, without exposing the Application Servers, in other words, it is used when you want your intranet application to be accessible through internet.The proxied server may be a webserver itself, or it may be an application server using a different protocol, or an application server.


How to Configure Reverse Proxy in iPlanet?

iPlanet 7 and above versions has inbuilt proxy plugins , so no need to load any plugins or libraries.
  • Add below configuration lines in obj.conf file.
          NameTrans fn="map" from="/Revese_Proxy" name="reverse-proxy" to="http:/Revese_Proxy"
             <Object name="reverse-proxy">
                  Route fn="set-origin-server" server="http://backendserver.com"
             </Object>

            <Object ppath="http:*">
                Service fn="proxy-retrieve" method="*"
            </Object>
  • Push/ Deploy the changes in iPlanet console. No need of restart.
Note: If you have custom Custom-obj.conf file (Virtual servers) and has client configuration your  Reverse proxy configuration is as below.

Custom-obj.conf
-----------------------------------------------------
<Object name="default">
     <Client urlhost="Reverse-Proxy-server.com">
          NameTrans fn="map" from="/Revese_Proxy" name="reverse-proxy" to="http:/Revese_Proxy"
     </Client>
</Object>

<Object name="reverse-proxy">
          Route fn="set-origin-server" server="http://backendserver.com"
</Object>

<Object ppath="http:*">
          Service fn="proxy-retrieve" method="*"
</Object>

Note:  Only one ppath="http:*" is required for multiple Reverse Proxy configuration. No need to duplicate the ppath block every time.

How Reverse Proxy works ?

When request comes to iplanet let ex http://Reverse-Proxy-server.com/Revese_Proxy
  • The default object NameTrans  directive  map  attribute function will be execute and  convert the logical URL of the request to a physical path name.
NameTrans fn="map" from="/Revese_Proxy" name="reverse-proxy" to="http:/Revese_Proxy"
  • If this physical path name (http:/Revese_Proxy) matches the  Object ppath="http:*" , ppath object directive proxy-retrieve function will be execute.
             <Object ppath="http:*">
                   Service fn="proxy-retrieve" method="*"
             </Object>

  • proxy-retrieve
    • The proxy-retrieve function retrieves a information from a remote server and returns it to the client. This function also enables you to configure the server to allow or block arbitrary methods. This function only works on the HTTP protocol.
  • After execution of the ppath Object proxy-retrieve  function ,process goes to the Object name="reverse-proxy" block.
               <Object name="reverse-proxy">
                    Route fn="set-origin-server" server="http://backendserver.com"
               </Object>
  • Route fn="set-origin-server
    • Set the back end  server information where to send the request .

 Alternative ways to configure the Reverse Proxy in iPlanet

  • Below configuration works same as above one but difference is removed the name attribute in NameTrans  and added the Route function in ppath Object.
           <Object name="default">
                  <Client urlhost="Reverse-Proxy-server.com">
                        NameTrans fn="map" from="/Revese_Proxy"  to="http:/Revese_Proxy"
                  </Client>
           </Object>

          <Object ppath="http:*">
                 Service fn="proxy-retrieve" method="*"
                 Route fn="set-origin-server" server="http://backendserver.com"
         </Object>

Thursday, October 9, 2014

Reverse Proxy configuration in Apache

A Reverse Proxy is a type of server that retrieves resources from other servers on behalf of the client. The resources are returned to the client as though they are originated from the server itself. Client feels that the resources are being provided by the server itself, and unaware of the servers that have provided the resources.Forward proxy acts as an intermediary for its clients and returns the resources accessible on the internet.Reverse proxy acts as an intermediary for the servers to return the resources provided by other servers.Reverse proxy is most widely used when you want your application accessible in the internet, without exposing the Application Servers, in other words, it is used when you want your intranet application to be accessible through internet.The proxied server may be a webserver itself, or it may be an application server using a different protocol, or an application server.


How to configure Reverse Proxy in Apache ?

  • Below Modules developed for Reverse proxy configuration in Apache
    • proxy_module               mod_proxy.so
    • proxy_http_module       mod_proxy_http.so  
  • Load the modules in httpd.conf file as below
    • LoadModule proxy_module       modules/mod_proxy.so
    • LoadModule proxy_http_module  modules/mod_proxy_http.so
  • Add the below configuration lines in httpd.conf file
             <Location /Reverse_Proxy/>
                   ProxyPass                http://backenserver.com/Reverse_Proxy/
                  ProxyPassReverse   http://backenserver.com/Reverse_Proxy/
            </Location>

Note: If Virtual hosts configured in Apache webserver place the above block of statements in Virtual host block.

<VirtualHost *:80>
          ServerName  myserver.com
    <Location /Reverse_Proxy/>
          ProxyPass                http://backenserver.com/Reverse_Proxy/
          ProxyPassReverse   http://backenserver.com/Reverse_Proxy/
     </Location>
</VirtualHost>

How Reverse Proxy Works ?

When request comes to Apache webserver it  checks for the context path in httpd.conf file and takes the  back end server information in Reverse proxy configuration block .Reverse Proxy module  sends the request to the back end (proxy server) and get the response from back end server and give to the client.

Is Context Path in Location tag and Context path of Back end server Should be same ?
No need to be same. We can change the context path in the Location tag as per our requirements.

Note: Back end server Context Path Should be valid one otherwise we wont get the results.

<VirtualHost *:80>
           ServerName  myserver.com
    <Location /Test_Reverse_Proxy/>
          ProxyPass                http://backenserver.com/Reverse_Proxy/
          ProxyPassReverse   http://backenserver.com/Reverse_Proxy/
     </Location>
</VirtualHost>
  • http://myserver.com/Test_Reverse_Proxy
  • http://myserver.com/Reverse_Proxy
 Both URL's gives the same results because both are accessing same back end servers

Note: Apache modules are Operating System's Specific so we should  load the Apache OS Specific Modules.

Wednesday, October 8, 2014

Disk Space Monitoring script

Disk space is the amount of data stored in a Disc Mount in Operating systems.Monitoring the disc space is important to avoid the issues to current running services.
  • Disc_Space_Monitoring script.sh
#!/bin/bash
HOSTNAME=`/usr/bin/hostname`

#Specify the mounts names below
Mount[0]=/devices
Mount[1]=/dev
Mount[2]=/temp

# Values which we need to get the alerts when mount reached to that level (%)
Threshold_value=40

Subject="Disk Space Monitoring alert"
ToList="admin@blog.com admin2@blog.com"
Sender="discgroup@blog.com"

Message="Your Custom Message"

for i in "${Mount[@]}"
do
       Mount_value=`df -h $i | awk '{print$5}' | tail -1 | cut -d '%' -f 0-1`
if [ "$Mount_value" -ge "$Threshold_value" ]; then
     
echo $Message | /usr/bin/mailx -s "$Subject" -r "$Sender" "$ToList"
fi
done
  • Enable the crontab utility  and add the below configuration line
0,15,30,45,50 * * * * cd /data/Disc_Space_Monitoring script; ksh Disc_Space_Monitoring script.sh
 >/dev/null 2>&1

Note: To know more about Crontab  Please refer the link Crontab







Monday, October 6, 2014

VI commands

  • vi test.txt     > create the file using the vi command
  • :q!                > quit the VI editor without save
  • :wq!             > save and quit the VI editor
  • shift + g (G) > Move  the cursor to the end of the file
  • g                  > Move cursor to the first line of the file
  • i                   >The characters typed in will be inserted before the current cursor position
  • I                   >The characters typed in will be inserted in first of the current line
  • Shift + A     >The characters typed in will be inserted in end of the current line
  • x                  > Delete the  character under the cursor
  • {number}x  > Delete the character under the cursor and next n number right characters
  • X                 >Delete the  character before the cursor
  • {number}X > Delete the n number characters before the cursor position (Not the cursor)
  • u                  >Undo the last change to the file. Typing u again will re-do the change. 
  • dd                > Delete the current line 
  • {number}dd > Remove the n number of lines down wards include current line
  • d{number}k > Delete the n  number of above lines including current line
  • d{number}j  > Delete the n number of down lines including current line
  • :3,18d        >delete lines 3 through 18
  • :1,$d              > Delete the all lines in file
  • :n  + Enter    > Go to nth line in a file Ex; :10 + ENTER
  • h                    >Move the cursor to the left one character position. 
  • j                     >Move the cursor down one line. 
  • k                    >Move the cursor up one line. 
  • l                     >Move the cursor to the right one character position. 
  • d^                  >Deletes from current cursor position to the beginning of the line. 
  • d$                  >Deletes from current cursor position to the end of the line. 
  • dw                  >Deletes from current cursor position to the end of the word. 
  • db                  > Deletes from current cursor position to the starting of the word
  • :1,$s/up/right/ > To Replace string Ex:1,$s/test1/test2
  • 16,25m30  > Move lines 16 through 25 to after line 30
  • 23,29co62 > Copy specified lines and place after line 62

Friday, October 3, 2014

Weblogic integration with Apache webserver

weblogic_module Module developed to integrate the weblogic application server with Apache webserver. Module version varied according with Apache version.

  • For 2.0.x Apache  : mod_wl_20.so
  • For 2.2.x Apache  : mod_wl_22.so
Weblogic_module  plugin available at weblogic installation package or can be download from Apache download Mirrors.

{Installation Path}/wlserver_10.3.5/server/plugin/solaris/sparc/mod_wl_20.so
{Installation Path}/wlserver_10.3.5/server/plugin/solaris/sparc/mod_wl_22.so

{Installation Path}/wlserver_10.3.5/server/plugin/linux/x86_64/mod_wl_20.so
{Installation Path}/wlserver_10.3.5/server/plugin/linux/x86_64/mod_wl_22.so

Note: Plugin is operating system specific so we  should use the Apache webserver  operating system specific plugin.

Steps to integrate Weblogic application server with Apache
  • Load the weblogic_module as below in httpd.conf file.
            LoadModule weblogic_module /modules/mod_wl_20.so
  • Add the below configuration tags in httpd.conf file.
  <Location /weblogic_app >
SetHandler weblogic-handler
WLLogFile /apache/2.0.55/logs/wlproxy.log
WLProxySSL ON
WebLogicCluster weblogic-server1.com:7009,weblogic-server2.com:7009
 </Location>

Note: If Virtual hosts has configured , place the above configuration in virtual host tag 

# Ensure that Apache listens on port 80
Listen 8080

# Listen for virtual host requests on all IP addresses
NameVirtualHost *:8080

<VirtualHost *:8080>
ServerName www.weblogic.com
  <Location /weblogic_app >
SetHandler weblogic-handler
WLLogFile /apache/2.0.55/logs/wlproxy.log
WLProxySSL ON
WebLogicCluster weblogic-server1.com:7009,weblogic-server2.com:7009
 </Location>
</VirtualHost>

  • Restart the Apache server to reflect the changes
Note: The above configuration is for weblogic clustered servers. If we have more managed servers in a weblogic cluster use the configuration as below 

WebLogicCluster weblogic-server1.com:7009,weblogic-server2.com:7009,weblogic-server3.com:7009,weblogic-server4.com:7009

<Location /weblogic_app >
SetHandler weblogic-handler
WLLogFile /apache/2.0.55/logs/wlproxy.log
WLProxySSL ON
WebLogicCluster weblogic-server1.com:7009,weblogic-                                                                         server2.com:7009,weblogic-server3.com:7009,weblogic-server4.com:7009
 </Location>

  • If we want to integrate  the standalone or single weblogic server instance use the below configuration.
  <Location /Single_weblogic_app>
SetHandler weblogic-handler
WebLogicHost weblogic-single_app.com
WebLogicPort 7009
 </Location>


Thursday, October 2, 2014

Websphere application server (WAS) integration with Apache Webserver

WAS plugins  developed to integrate the websphere application server with Apache server.WAS plugins vary according with Apache webserver version.

  • 2.0.x Apache version mod_was_ap20_http.so
  • 2.2.x Apache version mod_was_ap22_http.so
Plugins available along with WAS installation software package or can be download from IBM download mirrors.

WAS plugins location in installation package

{Installation Package}/plugin/plg.webserverplugins.pak/repository/plugins.http/bin/mod_was_ap20_http.so
.{Installation Package}/plugin/plg.webserverplugins.pak/repository/plugins.http/bin/mod_was_ap22_http.so

Add the below configuration lines in  httpd.conf file to Integrate the Websphere Application server with Apache webserver

LoadModule was_ap20_module  modules/mod_was_ap20_http.so

WebSpherePluginConfig  modules/plugin-cfg.xml

Note: WAS plugin is operating system specific so we should place the same os specific file other wise we can get the below error.

Syntax error on line 56 of /apache/2.0.55/conf/httpd.conf:
Cannot load /apache/2.0.55/modules/mod_was_ap20_http.so into server: /apache/2.0.55/modules/mod_was_ap20_http.so: wrong ELF class: ELFCLASS32

Tuesday, September 30, 2014

Tomcat integration with Apache webserver

AJP (Apache JServ protocol) is a communications protocol developed by apache.org to facilitate integration of the Tomcat container with third party web servers.Web server specific AJP plugins have been developed for Apache, IIS and Netscape's iPlanet.mod_jk.so  module developed to integrate the Apache web server with Tomcat container.

Steps to integrate the Apache webserver with Tomcat Container

  • Load the module as below in httpd.conf file

                 LoadModule jk_module modules/mod_jk.so

  • Add the below entry in httpd.conf file

Note: If virtual hosts configured , place the below configuration in virtual host block

<IfModule mod_jk.c>
     
      JkWorkersFile /data/apache/http-2.0.0.3/conf/workers.properties
      JkLogFile /data/apache/http-2.0.0.3/logs/mod_jkLog.log
      JkShmFile /tmp/jk-runtime-status
      JkLogLevel info
      JkMount /singleapp* Server-s
      JkMount /clusterapp* Server-c
   
</IfModule>

Create the worker.properties file as below 

workers.properties
-------------------------------------
worker.list=Server-s,Server-c  (Worker Nodes)
worker.Server-c.type=lb
worker.Server-c.balanced_workers=Server-c1, Server-c2 (Clustered Nodes)
worker.Server-c.sticky_session=1

worker.Server-c1.port=8009
worker.Server-c1.host=Server-c1.com
worker.Server-c1.type=ajp13
worker.Server-c1.lbfactor=1
worker.Server-c1.ping_mode=A

worker.Server-c2.port=8009
worker.Server-c2.host= Server-c2.com
worker.Server-c2.type=ajp13
worker.Server-c2.lbfactor=1
worker.Server-c2.ping_mode=A

worker.Server-s.port=8009
worker.Server-s.host=Server-s.com
worker.Server-s.type=ajp13
worker.Server-s.lbfactor=1
worker.Server-s.ping_mode=A

Server-s is single node and pointing to single tomcat server
Server-c is Cluster node and pointing to two clustered tomcat servers

Wednesday, September 10, 2014

Windows Command to get the list of file names in a folder


Open up your command prompt by typing cmd in the run dialog box and hitting Enter

Navigate to the directory which has the files and type the following command 

DIR /B /O:N   It will display the list of file names in current directory

DIR /B /O:N /S It will display the list of file names including sub directories

DIR /B /O:N > filename.txt  It will redirect the output to text file

To save file names from any sub-directories in the current folder, just add /S like 
This will save all the file names in the current directory to a text file. The text file will be saved in the same directory. 



Sunday, August 31, 2014

WLST script to change the weblogic admin password

WLST script to change the weblogic admin password

Note: This will work not only for admin server also works for other users present in DefaultAuthenticator

Prepare the shell script to set up the environmental variables and to invoke the wlst

PasswordChange.sh
----------------------------------------

#WL_HOME="Weblogic Home"
WL_HOME=/usr/weblogic/wlserver_10.3"

#JAVA_HOME="java Home"
JAVA_HOME="/usr/java"

# set up common environment
. "${WL_HOME}/server/bin/setWLSEnv.sh"

"${JAVA_HOME}/bin/java"  weblogic.WLST PasswordChange.py

PasswordChange.properties
-------------------------------------------

Weblogic_Admin_URL=t3://weblogic.com:9001
Weblogic_username=weblogic
Weblogic_password=weblogiccurrent
New_Weblogic_password=newPassword
domainName=weblogicdomainname

PasswordChange.py
-------------------------------------------
loadProperties("PasswordChange.properties")
connect(Weblogic_username,Weblogic_password,Weblogic_Admin_URL)
cd('/SecurityConfiguration/'+domainName+'/Realms/myrealm/AuthenticationProviders/DefaultAuthenticator')
cmo.resetUserPassword(Weblogic_username,New_Weblogic_password)
disconnect()
exit()

  • Changes will reflect immediately so no need to restart the server.
  • Update the new password in boot.properties if exist to avoid issue during the server start up.
  • we can also reset the user password through admin console
  • Navigate to security Relams --> myrelam -->users and groups
  • select the user and update the new password


Sunday, August 24, 2014

Apache web server plugins


  •  mod_wl_20.so : To integrate with weblogic application server
  • mod_jk.so : To integrate with Tomcat server
  • libmod_sm20.so: Site minder

Sunday, July 6, 2014

Cache controls for static files in iPlanet (Sun One Webserver)

Browser caching behavior is also subject to Web server settings for static file caching. Appropriate settings allow files that are rarely updated, such as image files, JavaScript files, or style sheet files, to be cached on the browser. Caching static files reduces network utilization and enhances Web Client response time.

  • we can enable the cache control for iplanet web server by adding  below tags in obj.conf file 


<If $path =~ "^(.*)(\\.)(jpg|jpeg|gif|png|js|css|woff)$">

      ObjectType fn="set-variable" insert-srvhdrs="Expires:$(httpdate($time + 64000))"
      ObjectType fn="set-cache-control" control="public,max-age=64000"

</If>
  • We can verify the Cache controls in web browser HTTP headers.







                                

Friday, July 4, 2014

Disable / enable a Web Agent (Siteminder Agent)

Disable a Web Agent (Disable sso protection)

Change the below parameter in WebAgent.conf

EnableWebAgent="NO"


Enable a Web Agent (Enable  sso protection)

Change the below parameter in WebAgent.conf

EnableWebAgent="YES"


Restart the Services to reflect the changes.

Thursday, September 12, 2013

WebSphere Profiles Types

Seven profile types can be created in WebSphere.

1)Application server Profile
2)Adminstrative Agent Profile
3)Job Manger Profile
4)Custom Profile
5)Deployment Manager Profile
6)Node Agent Profile
7)Cell Profile



Thursday, August 8, 2013

Weblogic Cluster constraints

It specifies that deployments targeted to a cluster succeed only if all servers in the cluster are running.

By default, cluster constraints are disabled and deployment is attempted only on the servers that are reachable at the time of deployment from the Administration Server. Any servers that have been shut down or are temporarily partitioned from the Administration Server will retrieve the deployment during server startup .

We can enable or disable from weblogic admin console.
Enabling Cluster Constrains
Click on Domain name -->select the "Enable Cluster Constraints" check box--> save the changes .
Disabling Cluster Constrains
Click on Domain name -->uncheck  the "Enable Cluster Constraints" --> save the changes .

Cluster constrains can also set through application by adding below parameter to weblogic.xml file.
   <session-descriptor>
   <persistent-store-type>replicated_if_clustered</persistent-store-type>
   </session-descriptor>



Weblogic Datasources

There are 3 types of data sources in 10.3.5
  •  Generic data source
  •  Grid Link datasource
  •  Mutli datasource
Datasource: contains pool of database connections that are created when datasource instance is created i.e.
A JDBC data source is an object bound to the JNDI tree that provides database connectivity through a pool of JDBC connections. Applications can look up a data source on the JNDI tree and then borrow a database connection from a data source.

  •  When it is deployed or targeted
  •  Server start-up
Multi Datasource: Abstraction around data source to provide load balancing or failover for datasource which are part of Multi Datasource
We can create the datasource as follows
  •  By Admin Console
  •  By WLST Script
  • By Programmatically using JMX API (by Developer)

System v/s Application JDBC Module – JDBC Modules created by Administrator using Console or WLST are called as System JDBC module where as JDBC module created by developer using WebLogic Workshop, other IDE (Integrated Development Environment) or XML editor are called as Application JDBC Module.

<jdbc-system-resource>
    <name>JDBC Data Source-test</name>
    <target>weblogiccluster</target>
    <descriptor-file-name>jdbc/JDBC_Data_Source-test-0556-jdbc.xml</descriptor-file-name>
  </jdbc-system-resource>

Note:If we create the data source  related xml file will be created in conf/jdbc folder .Xml file contains the all information like connection pools,username, passwords and targets .... etc.


Grid Link datasource
A single GridLink data source provides connectivity between WebLogic Server and an Oracle Database service targeted to an Oracle RAC cluster. It uses the Oracle Notification Service (ONS) to adaptively respond to state changes in an Oracle RAC instance
A GridLink data source includes the features of generic data sources plus the following support for Oracle RAC:

  •  "Fast Connection Failover"
  • "Runtime Connection Load Balancing"
  •  "Graceful Handling for Oracle RAC Outages"
  •  "XA Affinity"
  • "SCAN Addresses"
  • "Secure Communication using Oracle Wallet."

Starting Weblogic managed server without node manager

We can start Weblogic managed server instance using the startManagedWebLogic
Windows : startManagedWebLogic.cmd
Solaris/Linex : startManagedWebLogic.sh

Syntax to start the managed server is "startManagedWebLogic.cmd server_name admin_url"
            server_name is the name of the Managed Server
            admin_url is the url used to access the Administration Server for the domain.

For example: startManagedWebLogic.cmd Server1 http://localhost:7001

startManagedWebLogic.cmd command collects the managed server name and internally call the "startWebLogic.cmd" to start the managed server.

startManagedWebLogic present in Domain home bin folder


%DOMAIN_HOME%\bin\ startManagedWebLogic.cmd
$DOMAIN_HOME/bin/startManagedWebLogic.sh

Note: 

  • If we do not mention boot.properties it will ask the Admin server username and password.
  • If we mention the boot.properties script don't ask the Admin server username and password.



Disadvantage: Server will shut down if we press CTL + C , So we need to start the process as nohub.


Tuesday, August 6, 2013

Script to know the process id with KEY Name



PROCESS_NAME="Process_name"

PROCESS_ID=`ps -ef | grep -w $PROCESS_NAME | grep -v grep | awk '{print $2}'`

echo $PROCESS_ID

if test "${PROCESS_ID}" != ""
then
echo "Process is already running"

else
  echo "Process is not running"
fi


Note: If multiple processes are running with same KEY name, PROCESS_ID will contain the all process ids.

Ex: 1243 34343 7384 9099 4334

This Script will be useful in cronjob configuration to check any previous process is running before start the new process.


We can configure the process name for cronjob process with –Dapp Key


Ex: java –Dapp=Process_name –jar /data/Weblogic/test.jar

Monday, August 5, 2013

Weblogic Start up arguments


Enabling gc logs to  weblogic managed server



  • -Xloggc:/data/Weblogic/logs/gc.log

Jsp Scriptlet to display the application server name in web page.



<%= System.getProperty("weblogic.Name") %>


Using this tag in jsp page we can get the Weblogic server name in webpage .

Data source password change with out restart the web logic server



After we update system resources such as JDBC data sources, JMS modules, and diagnostic modules, we can redeploy them.
To update an application:
In the left pane of the Administration Console, select the domain that contains the system resources we want to redeploy.
In the right pane, click Control.
Click System Resources.
Select the check box next to the name of the system resources you want to redeploy.
Click Redeploy to redeploy the resources.

Click Yes to confirm our decision.

Thursday, August 1, 2013

Solaris Commands


  • uname -a 
    • To know the server information like operating system,servername,osversion
  • uptime
    • show how long the system has been up
  • last reboot
    • Display the server reboot information including last reboot time

ls Commands
  • ls  (Display the list of file)
  • ls  |head  (Display the first 10 files in the folder)
  • ls | head -n  (Display the first "n" number of files)
  • ls |tail (Display the last 10 files in a folder)
  • ls |tail -n (Display the last "n" numbers of files)
  • ls -a (Display the hidden files and normal fiels.Hidden files begin with a ".", i.e. ".htaccess" files.
  • ls -l|grep '^d' :To Display only Directories
  • ls -l |wc -l  To know the count of the files  in a directory
  • ls -lrt | grep -v "distribute*" | xargs zip logs_1.zip $*
  • ls d -1 $PWD/* > /tmp/ans/temp.txt
  • ls -f -1 $PWD/* > /tmp/ans/temp.txt
  • ls -l test.sh |cut -f18 -d' ' : To know the time stamp of the current file
  • sed '3d' fileName.txt (Remove the 3rd line)
  • sed '7,9d' filename.txt (Remove the interval between lines 7 and 9)
grep Commands
  • grep -n "1311179383812" file.txt (To find the line number of a word in file)
  • grep -w -c \"text\" file name (To find the count of the word in file)
  • jps -l (To Know the process id and arguments of java process)
Note: It is working in only solaris

Find Commands
  • find . -type f -exec grep -l "string" {} + 
    • Find the file names which contains the string in current and sub folders.         
  • find . -name '*.jsp' -exec touch {} \;
    • Find the jsp file names and update the time stamp of the jsp files.
Touch Commands
  • touch -t 200908201024 touch.txt 
    • To change the time stamp of the file to our choice        
prstat -Z

To know the cpu utilization in local zone
ZONEID    NPROC  SWAP   RSS       MEMORY    TIME                CPU ZONE
     2            57           4160M  3857M   1.5%              10:06:52 0.3%   tst-server


Change file or Directory ownership 

chown (change ownership command change the ownership of the file or directory)

chown  user2 temp.txt : It changes the ownership of the temp.txt file  to user2

chown -R java_user * :It changes the all files , directories and sub directories ownership  to java_user

  • netstat -an |grep -i "LISTEN"
    • To know the list of listen ports in a machine       
  • netstat -a |grep 7001
    • To know whether port 7001 is listen or not
  • showrev -p
    • To know the applied patched in solaris
  • showrev -a | grep "126546-05"
Patch: 126546-05 Obsoletes:  Requires:  Incompatibles:  Packages: SUNWbash, SUNWsfman
Patch: IDR151577-01 Obsoletes:  Requires: 126546-05 Incompatibles: 126546-06 Packages: SUNWbash
  • wget Commad
wget command location in solaris is : /usr/sfw/bin/wget

Usage:  wget http://ramaprasad434.blogspot.in/2013/07/solaris-commands.html




Making weblogic server as load balancing webserver


Making weblogic server as load balancing webserver


we can use the weblogic server as webserver by deploying a web application in weblogic server .
web application weblogic.xml and web.xml files should contains the below mentioned tags .
weblogic server details  need to be mention in WebLogicCluster parameter

  <init-param>
      <param-name>WebLogicCluster</param-name>
      <param-value>localhost:7003|localhost:7005</param-value>
    </init-param>


For example if you have one standalone  server and two  servers  in a cluster and Deployed the web application in standalone managed server .

If the request comes to stand alone  server it will send the request to the clustered servers.
weblogic.servlet.proxy.HttpClusterServlet servlet class is responsible to serve the requests.

web.xml
------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
 <servlet>
    <servlet-name>HttpClusterServlet</servlet-name>
    <servlet-class>weblogic.servlet.proxy.HttpClusterServlet</servlet-class>
    <init-param>
      <param-name>WebLogicCluster</param-name>
      <param-value>localhost:7003|localhost:7005</param-value>
    </init-param>
     
  </servlet>
  <servlet-mapping>
    <servlet-name>HttpClusterServlet</servlet-name>
    <url-pattern>/</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>HttpClusterServlet</servlet-name>
    <url-pattern>*.jsp</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>HttpClusterServlet</servlet-name>
    <url-pattern>*.htm</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>HttpClusterServlet</servlet-name>
    <url-pattern>*.html</url-pattern>
  </servlet-mapping>
</web-app>


weblogic.xml file
------------------
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
<weblogic-web-app>
    <context-root>/</context-root>
</weblogic-web-app>

Cron Tab


Cron is a UNIX, Solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed as cron jobs in UNIX, Solaris.  Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at specified times.

1. Crontab Restrictions

You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow. If that file does not exist, you can use crontab if your name does not appear in the file /usr/lib/cron/cron.deny.

If only cron.deny exists and is empty, all users can use crontab. If neither file exists, only the root user can use crontab. The allow/deny files consist of one user name per line.

2. Crontab Commands

export EDITOR=vi ;To specify a editor to open crontab file.

crontab -e    Edit your crontab file, or create one if it doesn’t already exist.

crontab -l      Display your crontab file.

crontab -r      Remove your crontab file.

crontab -v      Display the last time you edited your crontab file. (This option is only available on a few systems.)

3. Crontab file

Crontab syntax:

A crontab file has five fields for specifying day, date and time followed by the command to be run at that interval.

*     *       *           command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)

+------------- min (0 - 59)

Example:

0 6 * * 1 cd /data/test; ksh test.sh 1>>/logs/Test.log 2>>/logs/TestError.log

  •  Fist 0 indicates the min
  •  second "6" indicates the hour 6
  •   last "1" indicates the Moday

Here cron job will run every Monday 6 AM

  •  Test.log contians the normal SOP statements
  • TestError.log Contains the error and stack statements 

Weblogic Terminology

  • Domain: is a logically related group of WebLogic Server resources .A domain is an interrelated set of WebLogic Server resources that are managed as a unit.
  • Administration Server: The server instance which configures, manages, and monitors all other server instances and resources in the domain. An Administration Server is a WebLogic Server instance that maintains configuration data for a domain.
  • Managed Server: is a WebLogic Server instance that runs deployed applications.
  • When a Managed Server starts up, it connects to the domain's Administration Server to synchronize its configuration document with the document that the Administration Server maintains.You can start a Managed Server even if the Administration Server is not running. In this case, the Managed Server uses a local copy of the domain’s configuration files for its starting configuration and then periodically attempts to connect with the Administration Server. When it does connect, it synchronizes its configuration state with that of the Administration Server.
  •  If a Managed Server cannot connect to the Administration Server during start up, it can retrieve its configuration by reading its locally cached configuration data from the config directory.
  • A Managed Server that starts in this way is running in Managed Server Independence (MSI) mode. By default, MSI mode is enabled.
  • All Managed Servers in a cluster must reside in the same domain; you cannot split a cluster over multiple domains.
  •  All Managed Servers in a domain must run the same version of the WebLogic Server software. The Administration Server may run either the same version as the Managed Servers in the domain, or a later service pack.
  • Each Managed Server maintains a copy of the domain’s configuration files. This copy is read-only and can be updated only as part of a change management process.
  •  When the Administration Server starts up, it saves a JAR file named config-booted.jar that contains the configuration files. When you make changes to the configuration files, the old files are saved in the configArchive directory under the domain directory, in a JAR file with a sequentially-numbered name like config-1.jar.
  • Configuration changes that can take effect without a server restart are sometimes referred to as dynamic changes.
           Ex: if you change a Managed Server’s Listen Port value, the new port will not be used until the next time you start the Managed Server. The updated value is stored in config.xml, but the run time value is not affected.
  • configuration changes that require a server restart are sometimes referred to as non-dynamic changes
  • We can't start the server when it is in ADMIN mode, we can Resume the server to start.
  • We can Shutdown the server which is in ADMIN Mode.
  • The Administration Console is a browser-based Web application that allows you to configure and monitor your WebLogic Server domain, server instances, and running applications and their associated resources. You can also use the Administration Console to create new server instances and clusters and tune application descriptors