Wednesday, December 2, 2009

Delete the Web server definition in a standalone application server

The uninstaller program for the Web server plug-ins for WebSphere Application Server does not delete Web server definitions. However, you can delete a Web server definition from admin console OR by using the following wsadmin commands:

$AdminTask deleteServer { -serverName webserver1 -nodeName WebserverHostName-node_node }
$AdminTask removeUnmanagedNode { -nodeName WebserverHostName-node_node }
$AdminConfig save

Ex:
$AdminTask deleteServer { -serverName webserver1 -nodeName webserver1_node}
$AdminTask removeUnmanagedNode { -nodeName webserver1_node}
$AdminConfig save

Tuesday, December 1, 2009

Enabling trace for WSAdmin Tool

1. Enable tracing on the wsadmin tool. To do this, edit the WC_profiledir /properties/wsadmin.properties file. You must set the com.ibm.ws.scripting.traceString property to the correct trace specification. By default this line is commented out; be sure to remove the comment character (#) when you set the desired trace specification. The wsadmin client's trace file is WC_profiledir /logs/wsadmin.traceout.
2. Restart server1
3. Try to use wsadmin tool to manually export the EAR.
4. After the exception was thrown, collect the trace WC_profiledir/logs/wsadmin.traceout.

Thursday, November 12, 2009

Changing ORACLE LISTENER port number

Stop Listener

Change the port number in the following path:
D:\oracle\product\10.1.0\Db_1\NETWORK\ADMIN\listener.ora

Change the port number to desired port number and save.

Start the listener.

Run the following statement in the SQL prompt as sys dba.
ALTER SYSTEM SET LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)(HOST = host-name)(PORT = 1522))';

Check the status of listener, it should pick up your service name.

Monday, November 2, 2009

SOAP request Timeout

In wsadmin.traceout, the exception was thrown:org.apache.soap.SOAPException: [SOAPException: faultCode=SOAP-ENV:Client; msg=Read timed out; targetException=java.net.SocketTimeoutException: Read timed out]"
follows:
---------------------------
com.ibm.websphere.management.exception.ConnectorException: ADMC0009E: The system failed to make the SOAP RPC call: invokeat com.ibm.ws.management.connector.soap.SOAPConnectorClient.invokeTemplate(SOAPConnectorClient.java:642)at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:512)at com.ibm.ws.management.connector.soap.SOAPConnectorClient.invoke(SOAPConnectorClient.java:332)
----------------------------
SocketTimeoutException was possibly thrown because the SOAP timeout was not be long enough, if the exporting of the ear takes longer than the value specified by the SOAP timeout, it would fail.The SOAP timeout parameter was specified in \opt\IBM\WebSphere\AppServer\profiles\FairPrice\properties\soap.client.props, as following in your environment:
#------------------------------------------------------------------------------
# SOAP Request Timeout #
# - timeout (specified in seconds [default 180], 0 implies no timeout)#
#------------------------------------------------------------------------------
com.ibm.SOAP.requestTimeout=180
#------------------------------------------------------------------------------
So I have following suggestion to resolve the problem:
1. Chanage com.ibm.SOAP.requestTimeout to 0 or a larger value (e.g. 3600)
2. Restart server1

Export fix while Applying APAR

Find exportEar.jacl under $Commerce_installDIR/config/deployment/scripts. Make a backup.
2. Change
$WCSHelper exportApplication $AppName $AppPath
to
$AdminApp export $AppName $AppPath
3. Launch UPDI and retry the APAR deployment

Friday, September 25, 2009

Prepare url dynamically in Javascript

<% String sWebAppPath=UIUtil.getWebappPath(request); %>string url = window.location.protocol + "://" + window.location.hostname + "/" + <%=sWebAppPath%> + "/" + ViewName

Wednesday, September 23, 2009

Creating Cookie in a Session

The ViewCommandContext offers the getResponse() method which can be used to gain access to the HttpServletResponse, from where you can add the cookies.

http://publib.boulder.ibm.com/infocenter/wchelp/v6r0m0/index.jsp?topic=/com.ibm.commerce.api.doc/com/ibm/commerce/command/ViewCommandContext.html

For example:

if ( commandContext instanceof com.ibm.commerce.command.ViewCommandContext ) {
 com.ibm.commerce.command.ViewCommandContext v = (com.ibm.commerce.command.ViewCommandContext)commandContext;
 javax.servlet.http.HttpServletResponse response = (javax.servlet.http.HttpServletResponse)v.getResponse();
 javax.servlet.http.Cookie myCookie = new javax.servlet.http.Cookie("name","value");
 response.addCookie(myCookie);
} 

Tuesday, September 22, 2009

Home Page - Getting Admin Console in Store Front

https://localhost:8004/webapp/wcs/orgadmin/servlet/BuyAdminConsoleView?
XMLFile=buyerconsole.BuySiteAdminConsole&
customFrameset=common.MerchantCenterFramesetRHS&
webPathToUse=/webapp/wcs/stores/servlet&
sidebarViewName=SidebarDisplayView&
headerViewName=HeaderDisplayView&
footerViewName=FooterDisplayView&
actionName=organization&langId=-1&
storeIdToUse=10051&
buyer=true

Monday, September 21, 2009

Create DB Schema (When Instance exists)

Command For Create Schema (When Instace exists):
/opt/IBM/WebSphere/CommerceServer60/bin/createdb.oracle.sh /opt/IBM/WebSphere/CommerceServer60/instances/instance-name/properties/createInstance.properties

Check the log for Errors:
/opt/IBM/WebSphere/CommerceServer60/logs/populateDB_oracle.log

Monday, September 14, 2009

TNS NAME BLOCKED - SOLUTION

When lsnrctl status result as follows:
Instance "music", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully

Solution:
Connect as sysdba

SELECT STATUS FROM V$INSTANCE;
ALTER DATABASE MOUNT;
ALTER DATABASE OPEN;


Friday, September 11, 2009

Start and Stop Servers

Start Commerce Server:
/opt/IBM/WebSphere/AppServer/profiles/instance-name/bin/startServer.sh server1

Stop Commerce Server:
/opt/IBM/WebSphere/AppServer/profiles/instance-name/bin/stopServer.sh server1

Start WebServer:
/opt/IBMIHS/bin/apachectl -f /opt/IBM/WebSphere/CommerceServer60/instances/instance-name/httpconf/httpd.conf -k start

Stop WebServer:
/opt/IBMIHS/bin/apachectl -f /opt/IBM/WebSphere/CommerceServer60/instances/instance-name/httpconf/httpd.conf -k stop

HTTP Conf Syntax Check:
/opt/IBMIHS/bin/apachectl -f /opt/IBM/WebSphere/CommerceServer60/instances/instance-name/httpconf/httpd.conf -t

TNS-Names Settings

/opt/ora10g/product/10.2.0/client_1/network/admin/tnsnames.ora

suresh1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = IP-Address)(PORT = 1524))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = suresh1.sureshdomain.com)
)
)

Create user for WCS

drop user suresh1usr cascade;

drop tablespace suresh1db including contents and datafiles;

CREATE TABLESPACE suresh1db DATAFILE '/oracle/u01/app/oracle/oradata/suresh1/suresh1db.dbf' SIZE 4M AUTOEXTEND ON NEXT 2M MAXSIZE UNLIMITED;

CREATE USER suresh1usr IDENTIFIED BY suresh1usrs00 DEFAULT TABLESPACE suresh1db QUOTA UNLIMITED ON suresh1db;

grant all privileges to suresh1usr;

ALTER USER suresh1usr TEMPORARY TABLESPACE TEMP;

CONNECT suresh1usr/suresh1usrs00;

CREATE SCHEMA AUTHORIZATION suresh1usr;

Commerce Product Updates Installation Check

/opt/IBM/WebSphere/CommerceServer60/properties/version/update/backup/NIFStack.xml

/opt/IBM/WebSphere/CommerceServer60/instances/instance-name/properties/version/update/backup/NIFStack.xml

SAR Publish Guide

Place your Store file under the following path:
/opt/IBM/WebSphere/CommerceServer60/starterstores

Folder structure should be:
SureshStore/samplecatalogs/SureshStoreCatalogData.sar
SureshStore/SureshStore.sar

/opt/IBM/WebSphere/AppServer/profiles/instance-name/installedApps/WC_instance-name_cell/WC_instance-name.ear/xml/tools/devtools/SARRegistry.xml

Connect to Commerce Admin Console as site level
Store Archives -> Publish
Select the appropriate Store and click on Publish.

HostName only then redirect to URL

Senario:
When people are hitting to hostname only like "suresh.world.com", that request should be redirect to URL, that requirement can be achived by following snippet.

Code snippet:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^suresh\.world\.com [NC]
RewriteRule ^/?$ http://suresh.world.com/webapp/wcs/stores/servlet/TopCategoriesDisplay?storeId=10001&catalogId=10050&homePage=Y [R=permanent,L]

WAS Deployment Scripts

cd /opt/IBM/WebSphere/AppServer/bin
./wsadmin.sh

$AdminApp update WC_instance-name partialapp {-contents /home/wcuser/temp/Packaging.zip}

$AdminConfig save

$AdminApp update WC_instancename modulefile {-operation addupdate -contents /home/wcuser/temp/WebSphereCommerceServerExtensionsData.jar -contenturi WebSphereCommerceServerExtensionsData.jar -nodeployejb -usedefaultbindings -defaultbinding.datasource.jndi "jdbc/WebSphere Commerce Oracle Datasource demo" -defaultbinding.cf.jndi "jdbc/WebSphere Commerce Oracle Datasource demo" -defaultbinding.cf.resauth Per_Connection_Factory}

$AdminConfig save

import and export

exp userid=usr/usrpass@tnsname consistent=Y statistics=NONE file=/home/ora10g/backup/db_backup_11Sep2009.dmp log=/home/ora10g/backup/db_backup_11Sep2009.log full=Y

imp userid=usr/usrpass@tnsname fromuser=usr touser=usr1 file=/home/ora10g/backup/db_backup_11Sep2009.dmp log=/home/ora10g/backup/db_backup_imp_XXSep2009.log full=N

Sunday, June 14, 2009

Deleting all objects in a Schema

CREATE OR REPLACE PROCEDURE DROP_OBJECTS(P_Owners varchar2) IS
cursor obj_crs is
select owner, object_name, object_type
from all_objects
where owner = upper(P_Owners) AND object_name <> 'DROP_OBJECTS';
obj_REC obj_CRS%ROWTYPE;
l_grants_objects varchar2(500);
BEGIN
dbms_output.put_line('Begining to drop all objects');

Case upper(P_Owners)
when 'SYS' then dbms_output.put_line('Can drop objects for:'||upper(P_Owners));
when 'SYSTEM' then dbms_output.put_line('Can drop objects for:'||upper(P_Owners));
when 'WMSYS' then dbms_output.put_line('Can drop objects for:'||upper(P_Owners));
when 'TSMSYS' then dbms_output.put_line('Can drop objects for:'||upper(P_Owners));
when 'OUTLN' then dbms_output.put_line('Can drop objects for:'||upper(P_Owners));
when 'DBSNMP' then dbms_output.put_line('Can drop objects for:'||upper(P_Owners));
ELSE
Begin
FOR obj_REC IN obj_CRS LOOP
begin
dbms_output.put_line('OUT-1 -> ' || obj_REC.object_type);
CASE obj_REC.object_type
WHEN 'TABLE' THEN
l_grants_objects := 'drop table '||obj_REC.owner||'.'||obj_REC.object_name||' cascade constraints PURGE';
EXECUTE IMMEDIATE l_grants_objects;
-- WHEN 'MATERIALIZED VIEW' THEN
-- dbms_output.put_line('OUT-2 -> INSIDE MATERIALIZED VIEW');
-- l_grants_objects := 'drop MATERIALIZED VIEW ' || obj_REC.owner||'.'||obj_REC.object_name ;
-- dbms_output.put_line(' OUT-2 -> ' || l_grants_objects);
-- EXECUTE IMMEDIATE l_grants_objects;
WHEN 'INDEX' THEN l_grants_objects := '';
WHEN 'TYPE' THEN
l_grants_objects := 'drop type '||obj_REC.owner||'.'||obj_REC.object_name||' force';
EXECUTE IMMEDIATE l_grants_objects;
ELSE
dbms_output.put_line('OUT-2222** -> INSIDE MATERIALIZED VIEW');
l_grants_objects := 'drop '||obj_REC.object_type||' '||obj_REC.owner||'.'||obj_REC.object_name;
EXECUTE IMMEDIATE l_grants_objects;
END CASE;
dbms_output.put_line(l_grants_objects);
Exception
when others then
l_grants_objects := '';
end;
end loop;
end;
end case;
dbms_output.put_line('All objects are dropped');
End;
/

Friday, April 3, 2009

All Linux Commands in One Blog...

Please note that ">xxxx>" and ">>xxx>>" represents the dynamic content, you need to replace the xxxx with your content.

**********Windows Machine Remote Access**********
rdesktop -a >IP>
full-Screen:
rdesktop -a 16 -f >IP>
full-Screen with color support:
rdesktop -a 24 -f >IP>
**********************************************

**********Disk space***************************
df -h
*********************************************

**********Disk space used***********************
du -h -s >>path>>
*********************************************

*********Partions Details************************
fdisk -l
*********************************************

**********STARTUP SCRIPTS FILES*************
/etc/rc.d/rc.local
*********************************************

********** Setting the Path***********************
echo $PATH
export PATH=$PATH:/sbin:/usr/sbin
echo $PATH
*********************************************

*************Full Details about Partition Group*******
vgdisplay
*********************************************

*****************Linux Version Details************
cat /etc/redhat-release
*********************************************

*****************Extend the memory Example******
vgdisplay
df -h
lvextend -L +50G /dev/VolGroup00/LogVol00
ext2online /dev/VolGroup00/LogVol00
df -h
vgdisplay
*********************************************

********************Deleting the partition*********
lvchange -a n /dev/VolGroup00/lvfpapp
lvremove /dev/VolGroup00/lvfapapp
********************************************

*********************Extension Of Memory Details*
lvextend -L +>>SIZE>>G >>Physical Volume path>>
eg: lvextend -L +10G /dev/VolGroup00/LogVol00
ext2online >>Physical Device path>>
eg: ext2online /dev/VolGroup00/LogVol00
********************************************

********************To see the file flow *********
tail -f/n num of Lines >>filename with path>>
********************************************

********************Open port list**************
netstat -plan
********************************************

********************To find a file in the list *******
find >>source_path>> -name >>filename>>
find >>source_path>> -iname >>filename_pattern>>
**To find files with 777 permission
find >>path>> -perm 777
**To find the files more than specified size
find / -size +1048576k
****Folders only 755 and files only 644
find . -type d -exec chmod 0755 {} \;
find . -type f -exec chmod 0644 {} \;
********************************************

***** mounting a windows sharing file ****************
mount.cifs //ipaddress/directory /mount_pnt -o user=mid

Example:
mount.cifs //172.22.52.214/Softwares /mnt -o user=mindtree/m1006976
****************************************************

****find content in the files***********
grep -R ">>text>>" >>path>>/*
find . -name "*.jsp" -exec grep -H "/images/" {} \;
********************************

***************Delete the file ******
rm -f >>file_name>>
rm -rf >>Directory_name>>
********************************

****Delete the file from all of the directories**
find >>source_path>> -iname ">>filename_with_pattern>>" -exec rm {} \;
eg: find /opt/IBM/WebSphere/AppServer/profiles/instanceName/installedApps/WC_instanceName_cell/WC_instanceName.ear -iname "*.jsp" -exec rm {} \;
*******************************

********To List the files******
ls -l
*OnlyDirectories
ls -l | grep "^d" (or) ls -d >>path>>
****Find the most recently modified files (e.g. useful for big log directories)
ls -ltr
*****Find files modified on date****
ls -laR / | grep "2008-01-11"
*****************************

******Secure Copy**********
scp -r >>source_files_with_path>> >>remote_user>>@>>destination_serverName>>:>>destination_path>>
scp >>source_files_with_path>> >>remote_user>>@>>destination_serverName>>:>>destination_path>>
Ex:
scp -r /home/oracle/backup/exp_21Jan2009* oracle@172.22.1.21:/home/oracle/backUpFromDev/.
**************************

*****File OwnerShip and Permissions******
chmod -R 755 >>path>>
****It will change all the permission as 755 to all the files and folders in the path
chmod 755 >>filename_with_path>>

chown -R >>user>>:>>user_group>> >>Path>>
****It will change all the ownership to all the files and folders in the path
chown >>user>>:>>user_group>> >>filename_with_Path>>
***********************************

*****USER id and group of present user***
id
**********************************

****ZIP Commands*****
create:
tar -cvf mystuff.tar mystuff/
tar -czvf mystuff.tgz mystuff/

extracting:
tar -xvf mystuff.tar
tar -xzvf mystuff.tgz
zip -r file.zip folder-name/
unzip >>filename>>.zip
*********************

****Finding process id****
ps –elf | grep >>processname>>
eg: ps -elf | grep java
**********************

****X Window accessing from linux gui****
X :1 -query >ipa addrs of other box>
**********************************

*****RPM Commands**************
To install a rpm:
rpm –ivh filename

rpm find:
rpm –qa | grep >rpmname>
********************************

****To Disable Linux Fire Wall********
/etc/init.d/iptables stop
********************************

****To user details **
cat /etc/passwd
**************************

*****NFS Enabling********
Do the following in server machine:
1> Sharing the Directory using NFS
vi /etc/exports
add the following line
/>path-to-be-shared> >ip-address-of-accessing-machine>(ro|rw)
save and exit
2> Start the NFS Service
/etc/init.d/nfs start
3> Confirmation: please run the following command
showmount -e localhost
Do the following in client machine:
1> Check the Directory shared
showmount -e >ip-address-of-shared-machine>
2> create a Directory to be mounted
mount >ip-address-of-shared-machine>:/path-shared /mount-path
3> For Unmount, please run the following command
unmount /mount-path
************************

*****Oracle linux commands******
lsnrctl start
emctl status dbconsole
sqlplus sureshusr/sureshusrs00@//mira:1522/srbolstg.instanceName.com.sg

*Export and Import*
exp userid=sureshusr/sureshusrs00@sureshdb consistent=Y statistics=NONE file=F:\sureshDB\sureshdb11Jun08.dmp log=F:\sureshDB\sureshdb11Jun08.log full=N
exp userid=sureshusr/sureshusrs00@srbolstg FILE="/home/ora10g/backup/XSTRCLSTR_stage_102008.DMP" LOG="/home/ora10g/backup/XSTRCLSTR_stage_102008.log" TABLES=('XSTRCLSTR') COMPRESS=N INDEXES=N TRIGGERS=N CONSTRAINTS=N GRANTS=N
imp sureshusr/sureshusrs00@sureshdb fromuser=sureshusr touser=sureshusr file=D:\suresh\sureshdb06Jun08.dmp log=d:\suresh\impsureshdb06Jun08.log full=n
imp sureshusr/sureshusrs00@sureshdb FILE="F:\ServerMoves\stageMove\fromStage\Oct24\XSTRCLSTR_stage_102008.DMP" LOG="F:\ServerMoves\stageMove\fromStage\Oct24\imp_XSTRCLSTR_stage_102008.log" FROMUSER=sureshusr TOUSER=sureshUSR TABLES=(XSTRCLSTR) GRANTS=N INDEXES=N CONSTRAINTS=N
***Test Server Commands
exp FILE="/home/oracle/04112008_1.DMP" LOG="/home/oracle/exp_04112008_1.log" OWNER=('sureshUSR')

Stage dump query:
exp userid=sureshusr/sureshusrs00@srbolstg FILE="/home/ora10g/19012009_1.DMP" LOG="/home/ora10g/exp_19012009_1.log" OWNER=('sureshUSR')

Dev dump query:
exp userid=sureshusr/sureshusrs00@sureshdb FILE="/home/oracle/backup/exp_21Jan2009.DMP" LOG="/home/oracle/backup/exp_21Jan2009_log.log" OWNER=('sureshUSR')


imp FILE="/home/oracle/04112008_1.DMP" LOG="/home/oracle/imp_04112008_1.log" FROMUSER=sureshUSR TOUSER=sureshUSR IGNORE=Y

Dev dump query:
imp FILE="/home/oracle/backUpFromDev/exp_21Jan2009.DMP" LOG="/home/oracle/imp_21Jan2009_log.log" FROMUSER=sureshUSR TOUSER=sureshUSR IGNORE=Y
*****************************

*******Unlock the account & Changing password******
alter user sureshusr identified by sureshusrs00 account unlock;
**********************************