Middleware Tech

May 18, 2010

Switching Users: su in Linux

Filed under: Unix or Bash Commands — kmkumar @ 11:45 pm

Switching Users: su

To switch to another user, we use su command

Running su without any parameter will automatically try to login you to root user.

You’ll be prompted for the root password and, if you enter it correctly, will drop down to a root shell.


[vih@hostname ~]$ su

It will prompt for the password, if you give the correct password you will be logged into the root shell.

If you are already in the root user(shell) and want to switch to another ID, you don’t need to enter the password when you issue this command.

If u want to login to with a particular user, then

[vih@hostname ~]$ su kat
[vih@hostname ~]$ su – kat

The difference is,if we are using optional hyphen (-), this is tells us to switch identities and run the login scripts for that user (use the user specific environmental variables).
If there is no hyphen, the shell will take the globally set environment variables.


How to Install MQ on Redhat Linux

Filed under: MQ — kmkumar @ 11:23 pm

1.1 User creation

Login as root to install mq

Create following user with group name of “mqm” which will be used to run MQ
groupadd mqm # add group mqm (purpose of gropuadd is to create
a new group account)
useradd -g mqm mqm # add user mqm to group mqm
# gpn – groupname
# usrn — username
(useradd or usermod command is used to add a user to a
group.useradd command creates a new user or update
default new user information.usermod command modifies a
user account i.e. it is useful to add user to existing
group.User account related info is stored in /etc/passwd,
/etc/shadow and /etc/group.)

1.2 Create mount points to install MQ

create mqm folder under /opt and /var where the Websphere MQ gets installed.
create /opt/mqm

root@li-dev01/> cd /opt/
root@li-dev01/opt> mkdir mqm # make it RW to mqm group and 600MB in space capacity
create /var/mqm as above # make it RW to mqm group and 300MB in space capacity
root@li-dev01/var> mkdir mqm

1.3 Kernel configuration parameters

make following kernel changes (/etc/sysctl.conf ): # mq prerequisites
vi /etc/sysctl.conf
#add these propeties if they are not available
kernel.msgmni = 1024
kernel.shmmni = 4096
kernel.shmall = 2097152

edit /etc/sysctl.conf
kernel.sem 250 32000 32 1024

If you wish to load these sysctl values immediately, enter the command sysctl -p.
Note: If you do not issue the sysctl -p command, the new values are loaded when the system is rebooted.

1.4 Max open files

If the system is heavily loaded, you might need to increase the maximum possible number of open files. If your distribution supports the proc filesystem you can query the current limit by issuing the following command: cat /proc/sys/fs/file-max

If you are using a pluggable security module such as PAM (Pluggable Authentication Module), ensure that this does not unduly restrict the number of open files for the ’mqm’ user. For a standard WebSphere MQ queue manager, set the ’nofile’ value to 10240 or more for the ’mqm’ user. We suggest you add this command to a startup script in /etc/rc.d/…

1.5 Max process

A running WebSphere MQ queue manager consists of a number of thread programs, and each connected application will increase the number of threads running in the queue manager processes. You should ensure that the maximum number of processes which the mqm user is allowed to run is not unduly restricted by one of the pluggable security modules such as PAM. Set nproc for the mqm user to 4090 or more.

1.6 Root access privilege
this is needed when doing the MQ installation.

1.7 64bit consideration
Implications of a 64-bit queue manager Note: A 64-bit queue manager is available on the POWER, x86-64 and zSeries (s390x) platforms. When using the 64-bit queue manager, the use of the LIBPATH and LD_LIBRARY_PATH environment variable is not advised.

The recommended way of using WebSphere MQ commands and your applications is as follows:
• Unset LIBPATH and LD_LIBRARY_PATH and build your applications with a built in path to the appropriate WebSphere MQ libraries, this is detailed in the appropriate WebSphere MQ book for your type of WebSphere MQ application.
• If you need to set LIBPATH or LD_LIBRARY_PATH, consider not including /usr/lib in the path you specify in the variable. If you need to include /usr/lib in your LIBPATH or LD_LIBRARY_PATH then in order to avoid errors running 64-bit WebSphere MQ applications or WebSphere MQ commands, consider removing the symbolic links from /usr/lib to the 32-bit WebSphere MQ libraries using the dltmqlnk command. The symbolic links can be restored with the crtmqlnk command. You also need to build your applications with a built in path to the appropriate WebSphere MQ libraries.
Note that both the dltmqlnk command and the crtmqlnk command are scripts, and take no parameters.
• If you cannot use either of the first two options, run your applications in a different environment to the one which issues any WebSphere MQ commands.
Note: WebSphere MQ libraries are in the following locations: /opt/mqm/lib (32-bit libraries) and /opt/mqm/lib64 (64-bit libraries).

2. Installation of Websphere MQ on Linux:

2.1 Install rpm

2.1.1 Log in as root.

extract Websphere MQ files to the current directory(/home/test/Desktop/MQ)
tar -xzvf Websphere MQ for x86 6.0.tar.gz

And make sure all RPMs are in your current directory(/home/test/Desktop/MQ)

2.1.2 Run the mqlicense.sh script.

If you want to view a text-only version of the license, which can be read by a screen-reader, type:
root@li-dev01/MQ>./mqlicense.sh -text_only
The license is displayed.If want to accept the license without it being displayed, you can run the mqlicense.sh script with the -accept option.

# run this command from the current directory where Websphere MQ files are extracted.
root@li-dev01/MQ>./mqlicense.sh -accept
You must accept the license agreement before you can proceed with the installation.

2.1.3 Install components
Use the rpm -ivh command to install each component that you require.
The minimum components you must install are:
• MQSeriesRuntime
• MQSeriesJRE
• MQSeriesServer
• MQSeriesJava
This example shows a minimum installation:

rpm -ivh MQSeriesRuntime-6.0.0-0.i386.rpm MQSeriesSDK-6.0.0-0.i386.rpm MQSeriesServer-6.0.0-0.i386.rpm MQSeriesJava-6.0.0-0.i386.rpm
(At a strech u can install all the rpms or u can install one by one
(1.) rpm -ivh MQSeriesRuntime-6.0.0-0.i386.rpm
(2.) rpm -ivh MQSeriesSDK-6.0.0-0.i386.rpm
(3.) rpm -ivh MQSeriesServer-6.0.0-0.i386.rpm
(4.) rpm -ivh MQSeriesJava-6.0.0-0.i386.rpm)

for 64bit:
rpm -ivh MQSeriesRuntime-7.0.0-0.x86_64.rpm
rpm -ivh MQSeriesJava-7.0.0-0.x86_64.rpm MQSeriesJRE-7.0.0-0.x86_64.rpm MQSeriesServer-7.0.0-0.x86_64.rpm

You can reinstall the /bin/sh shell using RPM, or specify the RPM option –nodeps to disable dependency checking during installation of WebSphere MQ.

Install rest of the components:
rpm -ivh MQSeriesSDK-7.0.0-0.x86_64.rpm
rpm -ivh MQSeriesSamples-7.0.0-0.x86_64.rpm
rpm -ivh MQSeriesClient-7.0.0-0.x86_64.rpm
rpm -ivh gsk7bas-7.0-4.14.i386.rpm
rpm -ivh gsk7bas64-7.0-4.14.x86_64.rpm
rpm -ivh MQSeriesKeyMan-7.0.0-0.x86_64.rpm
rpm -ivh MQSeriesMan-7.0.0-0.x86_64.rpm
rpm -ivh MQSeriesTXClient-7.0.0-0.x86_64.rpm
rpm -ivh MQSeriesEclipseSDK33-7.0.0-0.x86_64.rpm
rpm -ivh MQSeriesConfig-7.0.0-0.x86_64.rpm

when you are installing MQSeriesIES33-7.0.0-0.x86_64.rpm, if you get any error saying that libstdc++.so is needed then go to the link

And search for libstdc++5.0-3.3.3-62745cl.i386.html GNU c++ library and download and Install that rpm.

use rpm -ivh -nodeps MQSeriesIES33-7.0.0-0.x86_64.rpm

2.1.4 client install:

Install minimum components:
• MQSeriesRuntime
• MQSeriesJRE
• MQSeriesServer
• MQSeriesJava

for 64bit:
rpm -ivh MQSeriesRuntime-7.0.0-0.x86_64.rpm
rpm -ivh MQSeriesJava-7.0.0-0.x86_64.rpm MQSeriesJRE-7.0.0-0.x86_64.rpm MQSeriesServer-7.0.0-0.x86_64.rpm

rpm -ivh MQSeriesClient-7.0.0-0.x86_64.rpm

2.2 Install verification

2.2.1 Create a sample Queue

login as MQM user
su – mqm

mqm@li-dev01>crtmqm -q QM_test.queue.manager #-q indicates default queue manager
There are 90 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager created.
Creating or replacing default objects for QM_test.queue.manager.
Default objects statistics : 58 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.

# if queue manager is not created and gives AMQ8081 error with863 code
download fixpack from

tar -xvf 6.0.2-WS-MQ-LinuxIA32-FP0005.tar
Make sure that Fix pack is extracted in the directory(/home/test/Desktop/Patch)

rpm -ivh all the below rpms

• MQSeriesRuntime
• MQSeriesJRE
• MQSeriesServer
• MQSeriesJava

# if queue manager is not created and gives AMQ8108 error with893 code then install IBMJava2-142-ia32-SDK-1.4.2-6.0.i386.rpm from the fix pack,

when you are installing this rpm if you get any error saying that libXp.so, then go to the link and download that and install this rpm

There are 90 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager ‘QM_test.queue.manager’ starting.
5 log records accessed on queue manager ‘QM_test.queue.manager’ during the log replay phase.
Log replay for queue manager ‘QM_test.queue.manager’ complete.
Transaction manager state recovered for queue manager ‘QM_test.queue.manager’.
WebSphere MQ queue manager ‘QM_test.queue.manager’ started.

5724-H72 (C) Copyright IBM Corp. 1994, 2008. ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM_test.queue.manager.

define qlocal (test_QL.queue)
1 : define qlocal (test_QL.queue)
AMQ8006: WebSphere MQ queue created.
2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

2.2.2 Test the sample queue
mqm@li-dev01>cd /opt/mqm/samp/bin
mqm@li-dev01>./amqsput test_QL.QUEUE
Sample AMQSPUT0 start
target queue is test_QL.QUEUE
Sample AMQSPUT0 end

# if /opt/mqm/samp/bin is not found install rpm MQSeriesSamples.

Sample AMQSPUT0 end
mqm@li-dev01>./amqsget test_QL.QUEUE
Sample AMQSGET0 start
no more messages
Sample AMQSGET0 end

3. Uninstalling Websphere MQ in Linux:

Remove install RPMs

login as root

root@websphere mwinstall]# rpm -ivh IBMJava2-SDK-1.4.2-0.0.i386.rpm to install, so I queried to find out what the software name of the rpm was as you cannot use the rpm filename that you used to install the rpm.

root@websphere mq]# rpm -qa | grep IBM

rpm -e IBMJava2-SDK-1.4.2-0.0

This worked however for the other rpm;s I had to remove the fix-packs first

Remove fix pack rpm’s

Use this command to see which Websphere MQSeries base rpms and fixpacks are installed
root@websphere mq]# rpm -qa | grep MQSeries

I used rpm -ivh IBMJava2-142-ia32-SDK-1.4.2-6.0.i386.rpm to apply fix pack
So I used rpm -e IBMJava2-142-ia32-SDK-1.4.2-6.0

install: rpm -ivh MQSeriesRuntime-U809950-6.0.2-2.i386.rpm
remove: rpm -e MQSeriesRuntime-U809950-6.0.2-2

install: rpm -ivh MQSeriesServer-U809950-6.0.2-2.i386.rpm
remove: rpm -e MQSeriesServer-U809950-6.0.2-2

install: rpm -ivh MQSeriesJava-U809950-6.0.2-2.i386.rpm
remove: rpm -e MQSeriesJava-U809950-6.0.2-2

Remove base rpm’s

I had to do in this order

rpm -e MQSeriesJava-6.0.0-0

rpm -e MQSeriesServer-6.0.0-0

rpm -e MQSeriesRuntime-6.0.0-0

Query to make sure they have all been removed

rpm -qa | grep MQSeries

Remove MQ directories

/opt/mqm # cd /opt , rm -rf mqm
/var/mqm # cd /var , rm -rf mqm

WS admin CMD(admin Control)

Filed under: WAS — kmkumar @ 11:20 pm

Example: Identifying running objects

In the WebSphere Application Server, MBeans represent running objects. You can interrogate the MBean server to see the objects it contains. Use the AdminControl object to interact with running MBeans.

  • Use the queryNames command to see running MBean objects. For example:

$AdminControl queryNames *

This command returns a list of all MBean types. Depending on the server to which your scripting client attaches, this list can contain MBeans that run on different servers:

  • If the client attaches to a stand-alone WebSphere Application Server, the list contains MBeans that run on that server.
  • If the client attaches to a node agent, the list contains MBeans that run in the node agent and MBeans that run on all application servers on that node.
  • If the client attaches to a deployment manager, the list contains MBeans that run in the deployment manager, all of the node agents communicating with that deployment manager, and all application servers on the nodes served by those node agents.

· The list that the queryNames command returns is a string representation of JMX ObjectName objects. For example:


This example represents a TraceServer object that runs in server1 on MyNode.

  • The single queryNames argument represents the ObjectName object for which you are searching. The asterisk (“*”) in the example means return all objects, but it is possible to be more specific. As shown in the example, ObjectName has two parts: a domain, and a list of key properties. For MBeans created by the WebSphere Application Server, the domain is WebSphere. If you do not specify a domain when you invoke queryNames, the scripting client assumes the domain is WebSphere. This means that the first example query above is equivalent to:

$AdminControl queryNames WebSphere:*

  • WebSphere Application Server includes the following key properties for the ObjectName object:
  • name
  • type
  • cell
  • node
  • process mbeanIdentifier

These key properties are common. There are other key properties that exist. You can use any of these key properties to narrow the scope of the queryNames command. For example:

$AdminControl queryNames WebSphere:type=Server,node=myNode,*

This example returns a list of all MBeans that represent server objects running the node myNode. The, * at the end of the ObjectName object is a JMX wildcard designation. For example, if you enter the following:

$AdminControl queryNames WebSphere:type=Server,node=myNode

you get an empty list back because the argument to queryNames is not a wildcard. There is no Server MBean running that has exactly these key properties and no others.

  • If you want to see all the MBeans representing applications running on a particular node, invoke the following example:

$AdminControl queryNames WebSphere:type=Application,node=myNode,*
Example: Turning traces on and off in a server process with the wsadmin tool

The following example turns on tracing in a server process:

  • Identify the object name for the TraceService MBean running in the process:

$AdminControl completeObjectName type=Server,name=server1,*

  • Obtain the name of the object and set it to a variable:

set ts [$AdminControl completeObjectName type=TraceService,process=server1,*]

  • Turn on traces for the server:

$AdminControl setAttribute $ts traceSpecification com.ibm.*=all=enabled
Example: Dumping threads in a server process

Use the AdminControl object to dump the Java threads of a running server.

  • For example, in Jacl:

set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]

$AdminControl invoke $jvm dumpThreads

This example produces a Java core file. You can use this file for problem determination.

Example: Starting a server using wsadmin

The following example starts an application server with the node specified.

  • The following command starts server1 in mynode node:

$AdminControl startServer server1 mynode

Example output:

WASX7319I: The serverStartupSyncEnabled attribute is set to false. A startwill be attempted for server “server1” but the configuration information fornode “mynode” may not be current.WASX7262I: Start completed for server “server1” on node “mynode”

  • The startServer command has several command syntax options. If you have Network Deployment installation, you have to use one of following:

$AdminControl startServer serverName nodeName

$AdminControl startServer serverName nodeName waitTime

  • If you have an application server base installation, you can use the following syntax in addition to the previous syntax:

$AdminControl startServer serverName

$AdminControl startServer serverName waitTime

Example: Stopping a server using wsadmin

The following example stops an application server with the node specified.

  • The following command stops server1 in node mynode.

$AdminControl stopServer server1 mynode

Example output:

WASX7337I: Invoked stop for server “server1” Waiting for stop completion.
WASX7264I: Stop completed for server “server1” on node “mynode”

  • The stop command has serveral command syntaxes.

If you have Network Deployment installation, use the one of following command syntax:

$AdminControl stopServer serverName nodeName

$AdminControl stopServer serverName nodeName immediate

If you have application server base installation, you can use the following syntax, in addition to the previous syntax:

$AdminControl stopServer serverName

$AdminControl stopServer serverName immediate

Example: Querying the server state using the wsadmin tool

The following example queries the server state.

  • Identify the server and assign it to the server variable.

set server [$AdminControl completeObjectName cell=mycell,node=mynode,name=server1,type=Server,*]

This command returns the server MBean that matches the partial object name string.
Example output:


  • Query for the state attribute.

$AdminControl getAttribute $server state

The getAttribute command returns the value of a single attribute.

Example output:

Example: Starting a listener port using wsadmin

The following example starts a listener port on an application server.

  • Identify the listener port MBeans for the application server and assign it to the lPorts variable.

set lPorts [$AdminControl queryNames type=ListenerPort,cell=mycell,node=mynode,process=server1,*]
This command returns a list of listener port MBeans.

Example output:WebSphere:cell=mycell,name=ListenerPort,mbeanIdentifier=server.xml#ListenerPort_1,




  • Start the listener port if it is not started with the following example:·

foreach lPort $lPorts

{ set state [$AdminControl getAttribute $lport started]

if {$state == “false”} {

$AdminControl invoke $lPort start



This piece of Jacl code loops through the listener port MBeans. For each listener port MBean, get the attribute value for the started attribute. If the attribute value is set to false, then start the listener port by invoking the start operation on the MBean.

Example: Testing data source connection using wsadmin

The following example tests a dataSource, to ensure a connection to the database.

  • Identify the DataSourceCfgHelper MBean and assign it to the dshelper variable.

set dshelper [$AdminControl queryNames type=DataSourceCfgHelper,process=server1*]

Example output:



  • Test the connection.

$AdminControl invoke $dshelper testConnectionToDataSource “COM.ibm.db2.jdbc.DB2XADataSource dbuser1 dbpwd1 {{databaseName jtest1}} c:/sqllib/java12/db \”\” \”\””

This example command invokes the testConnectionToDataSource operation on the MBean, passing in the classname, userid, password, database name, JDBC driver class path, language, and country.

Example output:

DSRA8025I: Successfully connected to DataSource

Example: Starting an application using wsadmin

The following example starts an application:

  • Identify the application manager MBean for the server where the application resides and assign it the appManager variable.

set appManager [$AdminControl queryNames cell=mycell,node=mynode,type=ApplicationManager,process=server1,*]

This command returns the application manager MBean.
Example output:



  • Start the application.

$AdminControl invoke $appManager startApplication myApplication

This command invokes the startApplication operation on the MBean, passing in the application name to start.

Example: Stopping running applications on a server using wsadmin

The following example stops all running applications on a server:

  • Identify the application manager MBean for the server where the application resides, and assign it to the appManager variable.

set appManager [$AdminControl queryNames cell=mycell,node=mynode,type=ApplicationManager,process=server1,*]

This command returns the application manager MBean.

Example output:WebSphere:cell=mycell,name=ApplicationManager,mbeanIdentifier=ApplicationManager,


  • Query the running applications belonging to this server and assign the result to the apps variable.

set apps [$AdminControl queryNames cell=mycell,node=mynode,type=Application,process=server1,*]

This command returns a list of application MBeans.
Example output:





  • Stop all the running applications.

foreach app $apps


set appName [$AdminControl getAttribute $app name]

$AdminControl invoke $appManager stopApplication $appName


This command stops all the running applications by invoking the stopApplication operation on the MBean, passing in the application name to stop.

Example: Querying application state using wsadmin

The following examples queries for the presence of Application MBean to find out whether the application is running.

$AdminControl completeObjectName type=Application,name=myApplication,*

If myApplication is running, then there should be an MBean created for it. Otherwise, the command returns nothing. If myApplication is running,
the following is the example output:


Example: Updating the Web server plug-in configuration files using wsadmin

This examples regenerates the web serer plugin configuration file.

  • Identify the web server plugin configuraiton file generator MBean and assign it to the pluginGen variable.

set pluginGen [$AdminControl completeObjectName type=PluginCfgGenerator,*]

Example output:

  • Generate the updated plugin configuration file.


$AdminControl invoke $pluginGen generate “c:/WebSphere/DeploymentManager c:/WebSphere/DeploymentManager/config mycell null null plugin-cfg.xml”

This example command assumes a Windows system install. It invokes the generate operation on the MBean, passing in the install root directory, configuration root directory, cell name, node name, server name, and output file name. To pass in null as the value of an argument, enter null as given in the example. This is provided for operation that allows null as the value of its argument and processes null differently from an empty string. In this example, both node and server are set to null. The generate operation generates plugin configuration for all the nodes and servers resided in the cell. The output file plugin-cfg.xml is created in the config root directory.

You can modify this example command to generate plugin configuration for a particular node or server by specifying the node and server names.

How MDB listeners work with a listener port in WAS

Filed under: WAS — kmkumar @ 11:19 pm


MQ Interview questions

Filed under: Interview,MQ — kmkumar @ 11:17 pm


May 8, 2010

DataPower Appliance Firmware and Documentation

Filed under: DP Documents — kmkumar @ 10:08 pm



One more blog about Datapower



Filed under: Forums — kmkumar @ 10:05 pm

All Websphere product forums


Websphere MQ


IBM Websphere datapower Community forum


Websphere Datapower SOA appliance


Websphere App Server


Integrating DataPower with WebSphere MQ

Filed under: DP Documents,IBM DataPower,WAS — kmkumar @ 10:00 pm



Websphere Message Broker

Filed under: WAS — kmkumar @ 9:50 pm

websphere message broker is used to mediate between various applications and handle message routing and message transformation from source / originating system to endpoint / receiver application.

IBM website has a very good  quick tour which is very useful for beginners


May 5, 2010

Datapower integration with websphere

Filed under: DP Documents,IBM DataPower,WAS — kmkumar @ 10:53 pm

Monitoring WebSphere DataPower SOA Appliances


Managing WebSphere DataPower SOA Appliances via the WebSphere Application Server V7 Administrative Console


Next Page »

Create a free website or blog at WordPress.com.