WebSphere Issues

28/02/2010

When rendering a JSP component with the JSR286 rendering portlet

Filed under: WCM, WebSphere Portal — Ishtiaque @ 10:29 am

When rendering JSP components through the JSR286 local rendering portlet you need to check the Workspace.WCM_RENDERINGCONTEXT_KEY attribute on the original PortletRequest.

There are 2 ways to achieve that:

1. Import the JSR Portlet JSP Tag lib and get the RenderingContext from the renderRequest object.
This approach is more elegant but it will only work when rendering via the JSR286 rendering.

<%@ taglib uri=”http://java.sun.com/portlet&#8221; prefix=”portlet” %>
<portlet:defineObjects/>
<%
RenderingContext renderingCtx = request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
if(renderingCtx == null) {
renderingCtx = (RenderingContext)renderRequest.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
}
%>

2. Get the PortletRequest from the ServletRequest as documented in the Java Portlet 2.0 Specification.
This works for rendering via the both (legacy and JSR286) rendering portlets and also for servlet rendering.

<%@ page import=”javax.portlet.*”%>
<%
RenderingContext renderingCtx = (RenderingContext)request.getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
if(renderingCtx == null) {
Object portletRequest = request.getAttribute(“javax.portlet.request”);
if(portletRequest != null && portletRequest instanceof PortletRequest) {
// JSR286 rendering
renderingCtx = (RenderingContext) ((PortletRequest)portletRequest).
getAttribute(Workspace.WCM_RENDERINGCONTEXT_KEY);
}
}
%>

Rerfernces:

http://www-10.lotus.com/ldd/portalwiki.nsf/dx/wcm-jsr-286-portlet-tips-issues-and-limitations

10/02/2010

Web Site Monitor script

Filed under: Linux, Scripts — Ishtiaque @ 10:31 am

Please! follow the link to download the script: http://www.rayslinks.com/Web%20Site%20Monitor.html

Backup WP DB2 databases

Filed under: DB2, Linux, Scripts, WebSphere Portal — Ishtiaque @ 10:26 am

curDate=`date +%d%m%y_DBs_WP615`
cd /opt/Backups/databases/temp

echo “Backing-up fdbkdb into /opt/Backups/databases/temp directory…”
su – db2inst1 -c “db2 backup db fdbkdb”
echo “Backing-up lmdb into /opt/Backups/databases/temp directory…”
su – db2inst1 -c “db2 backup db lmdb”
echo “Backing-up cusdb into /opt/Backups/databases/temp directory…”
su – db2inst1 -c “db2 backup db cusdb”
echo “Backing-up comdb into /opt/Backups/databases/temp directory…”
su – db2inst1 -c “db2 backup db comdb”
echo “Backing-up reldb into /opt/Backups/databases/temp directory…”
su – db2inst1 -c “db2 backup db reldb”
echo “Backing-up jcrdb into /opt/Backups/databases/temp directory…”
su – db2inst1 -c “db2 backup db jcrdb”

echo -e “nArchiving all the databases in /opt/Backups/databases/”$curDate
tar -cvf /opt/Backups/databases/$curDate.tar *

echo -e “nDeleting all the databases from /opt/Backups/databases/temp directory…n”
rm -f /opt/Backups/databases/temp/*.*

09/02/2010

Auto start VNCServer in SLES v9 during system bootup

Filed under: Linux — Ishtiaque @ 9:48 am

1. Set VNC Server Password:
vncpasswd

2. Comment out the following two lines in xstartup file located in .vnc/ directory:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

3. Replace the highlighted letters in the xstartup file:

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
twm &

with the following:

xterm -geometry 1024×786+10+10 -ls -title “$VNCDESKTOP Desktop” &
startx &

3. Add following line in boot.local file located in /etc/init.d/ directory:
vncserver :1

4. Set auto run xinetd and vnc daemons upon system boot up:
chkconfig -s xinetd on
chkconfig -s vnc on

5. Restart machine.

Auto start VNCServer in RHEL V5 during system bootup

Filed under: Linux — Ishtiaque @ 9:47 am

1. Set VNC password:
vncpasswd

2. Start the vncserver with root user by using the command vncserver :1

3. Add following lines in xstartup file located in /root/.vnc directory:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

4. Replace the highlighted letters in the xstartup file:

xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
twm &

with the following:

xterm -geometry 1024×768+10+10 -ls -title “$VNCDESKTOP Desktop” &
startx &

5. Switch user to root account and edit file vncservers located at /etc/sysconfig.  Add following lines at the bottom of the file:

VNCSERVERS=”1:root”
VNCSERVERARGS[1]=”-geometry 1024×768″

6. Set auto run vncserver daemon upon system boot up:
chkconfig –level 5 vncserver on

7. Restart the machine

Archive a directory using tar with current date

Filed under: Linux, Scripts, WAS, WebSphere Portal — Ishtiaque @ 9:43 am

1. Backup “WebSphere” directory:

  • tar -C /opt/IBM -zpcvf /tmp/WebSphere.tar.gz ¬†WebSphere
  • tar -tvf /tmp/WebSphere.tar.gz

2. Restore “WebSphere” directory:

  • mv /opt/IBM/WebSphere /opt/IBM/WebSphere_org (Note: Before restoring rename existing WebSphere directory)
  • tar -C /opt/IBM -pxvf /tmp/WebSphere.tar.gz
  • diff -r /opt/IBM/WebSphere /opt/IBM/WebSphere_org (Compare files between restored and original directory)

Following script can be used to automate the backup process of WebSphere directory:

#!/bin/bash

DIR=WebSphere
PARENT_DIR=/opt/IBM
DATE=`date +%d%m%y`
ARCHIVE=/tmp/$DIR.$DATE.tar.gz

echo Archiving $PARENT_DIR/$DIR directory into $ARCHIVE
tar -C $PARENT_DIR -zpcvf $ARCHIVE $DIR

 

Restart WP and archive logs

Filed under: Linux, Scripts, WebSphere Portal — Ishtiaque @ 9:41 am

echo “Stoping WebSphere_Portal server…”
/opt/IBM/WebSphere/AppServer/bin/stopServer.sh WebSphere_Portal

echo “Archiving WebSphere_Portal logs…”
mv -f /opt/IBM/WebSphere/wp_profile/logs/WebSphere_Portal/*.* /opt/IBM/WebSphere/wp_profile/logs/WebSphere_Portal/archive

echo “Starting WebSphere_Portal server…”
/opt/IBM/WebSphere/AppServer/bin/startServer.sh WebSphere_Portal

Change WP Host, Cell or Node name

Filed under: WAS, WebSphere Portal — Ishtiaque @ 8:50 am

1. In order to change Host name, Cell name or Node name in WP v6, plz follow IBM Technote:
http://www-01.ibm.com/support/docview.wss?uid=swg21304780

2. In order to change Host name, Cell name or Node name in WP v6.1, plz follow IBM Technote:
http://www-01.ibm.com/support/docview.wss?rs=688&ca=portall2&uid=swg21390600

Create a free website or blog at WordPress.com.