Warehouse for various notes, scripts, code samples, tips/tricks, etc. relating to different technologies like WebSphere Application Server (WAS), WebSphere Portal, Java, Java EE, DB2, etc.
Wednesday, October 19, 2011
Enable user redirection in IBM HTTP Server 7.0
To redirect all the incoming requests to a sub-directory or a specific URL in IBM HTTP Server follow below steps:
Open C:\IBM\HTTPServer\conf\httpd.conf file in edit mode.
1. Un-comment following live in the file by removing "#" from the front of the line.
#LoadModule rewrite_module modules/mod_rewrite.so
2. Enable rewrite engine by adding following line to the end of the file:
RewriteEngine on
3. Add rewrite rule after the above line using the below example:
RewriteRule ^/$ wps/portal [L,R]
4. Save the file
5. Restart IBM HTTP Server.
Now all user requests will be redirected to "wps/portal" sub URL. You can redirect the user to another website also using the same method but in that situation you have to provide full URL starting with Http://...
Wednesday, August 10, 2011
WCM Contect Access Error using API - WCM_Workspace W IWKCW1005X: The Member: UserX Could not be found in the User Repository. Reason: UserX
[8/10/11 13:48:23:737 CDT] 0000006e WCM_Workspace W IWKCW1005X: The Member: UserX Could not be found in the User Repository. Reason: UserX
[8/10/11 13:48:23:753 CDT] 0000006e SystemOut O exception is- com.ibm.workplace.wcm.api.exceptions.AuthorizationException: IWKPY1015X: Unauthorized access by {PrincipalInformation: {dn: anonymous_user, memberId: anonymous_user_id, displayName: , name: , locale (thread): en_US, isValidUser: true, isUser: Type: User, isUserLazyLoaded: false}, 1, {false, {userAccess={}}, {editorAccess={}}, {managerAccess={}}, [anonymous_user%anonymous_user_id, all_users%all_users_group_id, anonymous_user%anonymous_user_id]}} - IWKPY1016X: Unauthorized access on Company Overview by [anonymous portal user]
Encountered above exception when I was trying to access WCM content using API calls from my portlet. After researching for long and spending multiple nights figuring the reason behind this exception I found that I need to give proper access rights to all the users under "Contributor" tab of the Portal Content > Web Content Libraries > Library Name.
Click on the button with "key" to open the resource permissions for the library. Then click on the button with "key" against "Contributor". Add "All authenticated Portal Users" and "Anonymous Portal Users" to the permissions.
This will resolve the above problem.
More information is available on the below link:
PM42031: REFERENCE PROBLEM IN INLINE EDITING WITH THE JSR-286 WEB CONTENT VIEWER
[8/10/11 13:48:23:753 CDT] 0000006e SystemOut O exception is- com.ibm.workplace.wcm.api.exceptions.AuthorizationException: IWKPY1015X: Unauthorized access by {PrincipalInformation: {dn: anonymous_user, memberId: anonymous_user_id, displayName: , name: , locale (thread): en_US, isValidUser: true, isUser: Type: User, isUserLazyLoaded: false}, 1, {false, {userAccess={}}, {editorAccess={}}, {managerAccess={}}, [anonymous_user%anonymous_user_id, all_users%all_users_group_id, anonymous_user%anonymous_user_id]}} - IWKPY1016X: Unauthorized access on Company Overview by [anonymous portal user]
Encountered above exception when I was trying to access WCM content using API calls from my portlet. After researching for long and spending multiple nights figuring the reason behind this exception I found that I need to give proper access rights to all the users under "Contributor" tab of the Portal Content > Web Content Libraries > Library Name.
Click on the button with "key" to open the resource permissions for the library. Then click on the button with "key" against "Contributor". Add "All authenticated Portal Users" and "Anonymous Portal Users" to the permissions.
This will resolve the above problem.
More information is available on the below link:
PM42031: REFERENCE PROBLEM IN INLINE EDITING WITH THE JSR-286 WEB CONTENT VIEWER
Wednesday, July 6, 2011
Datasource Isolation Levels in WebSphere Application Server (WAS)
WebSphere Application Server (WAS) 6.0.2 and higher provide a new custom property webSphereDefaultIsolationLevel. This property can take one of the four values as listed below:
a) 8 -> TRANSACTION_SERIALIZABLE -> Repeatable Read (RR)
b) 4(default) -? TRANSACTION_REPEATABLE_READ -> Read Stability (RS)
c) 2 -> TRANSACTION_READ_COMMITTED -> Cursor Stability (CS)
d) 1 -> TRANSACTION_READ_UNCOMMITTED -> Uncommitted Read (UR)
a) 8 -> TRANSACTION_SERIALIZABLE -> Repeatable Read (RR)
b) 4(default) -? TRANSACTION_REPEATABLE_READ -> Read Stability (RS)
c) 2 -> TRANSACTION_READ_COMMITTED -> Cursor Stability (CS)
d) 1 -> TRANSACTION_READ_UNCOMMITTED -> Uncommitted Read (UR)
Labels:
Data Source,
DB2,
SQL,
WAS,
WebSphere,
WebSphere Application Server,
WebSphere Portal
Thursday, June 9, 2011
WebSphere Application Server (WAS) fails to start with XAException: XAER_RMERR (xa_recover)
This error comes when WebSphere Application Server (WAS) and/or Oracle servers were not shut down properly, then you might see XAException with (xa_recover) in the description of the error then it is very possible that the user which is being used to connect to the Oracle database by the WebSphere Application Server (WAS) does not have select permission on DBA_PENDING_TRANSACTIONS.
Run the following command SQL Plus as SYSOPER or SYSDBA
grant select on DBA_PENDING_TRANSACTIONS to PUBLIC
OR
grant select on DBA_PENDING_TRANSACTIONS to username
This should resolve the issue.
Run the following command SQL Plus as SYSOPER or SYSDBA
grant select on DBA_PENDING_TRANSACTIONS to PUBLIC
OR
grant select on DBA_PENDING_TRANSACTIONS to username
This should resolve the issue.
Wednesday, June 8, 2011
Profile Management on 64 bit WebSphere Application Server (WAS) 7.0.x
WebSphere Application Server (WAS) 7.0.x does not provide Graphical Profile Management Tool like its sister 32 bit version does. Therefore you have to rely on manageprofiles.(bat/sh) command to create/augment/delete a profile.
Below command creates Deployment Manager Profile on the same server on which WebSphere Portal is installed.
manageprofiles -create -profileName DmgrDev01 -profilePath E:/IBM/WebSphere/DmgrDev01 -templatePath E:/IBM/WebSphere/AppServer/profileTemplates/management -serverType DEPLOYMENT_MANAGER -nodeName nodeo1 -cellName cello1 -hostName portal.pankaj.com -validatePorts -defaultPorts
This command has to be executed from\bin directory. The node name and cell should be different from the ones used while installing Portal Server.
Below command creates Deployment Manager Profile on the same server on which WebSphere Portal is installed.
manageprofiles -create -profileName DmgrDev01 -profilePath E:/IBM/WebSphere/DmgrDev01 -templatePath E:/IBM/WebSphere/AppServer/profileTemplates/management -serverType DEPLOYMENT_MANAGER -nodeName nodeo1 -cellName cello1 -hostName portal.pankaj.com -validatePorts -defaultPorts
This command has to be executed from
Custom Authentication Filter
package com.pankaj.filters;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ibm.portal.auth.ExplicitLoginFilter;
import com.ibm.portal.auth.ExplicitLoginFilterChain;
import com.ibm.portal.auth.FilterChainContext;
import com.ibm.portal.auth.exceptions.AuthenticationException;
import com.ibm.portal.auth.exceptions.AuthenticationFailedException;
import com.ibm.portal.auth.exceptions.PasswordInvalidException;
import com.ibm.portal.auth.exceptions.SystemLoginException;
import com.ibm.portal.auth.exceptions.UserIDInvalidException;
/**
* @author Pankaj Gupta
* build path dependency
* 1. C:/IBM/WebSphere/PortalServer/base/wp.auth.base/shared/app/wp.auth.base.jar
* 2. C:/IBM/WebSphere/PortalServer/base/wp.auth.cmd/shared/app/wp.auth.cmd.jar
*
*/
public class CustomExplicitLoginFilter implements ExplicitLoginFilter {
Context context = null;
PumaHome pumaHome = null;
public CustomExplicitLoginFilter() {
super();
}
public void init(SecurityFilterConfig filterConfig) throws SecurityFilterInitException {
System.out.println("Entering com.pankaj.filters.CustomExplicitLoginFilter.init(...)");
try{
context = new InitialContext();
pumaHome = (PumaHome) context.lookup(com.ibm.portal.um.PumaHome.JNDI_NAME);
} catch (Exception exp){
exp.printStackTrace();
}
System.out.println("Exiting com.pankaj.filters.CustomExplicitLoginFilter.init(...)");
}
public void login(HttpServletRequest req, HttpServletResponse resp, String userID, char password[],
FilterChainContext portalLoginContext, Subject subject, String realm, ExplicitLoginFilterChain chain)
throws LoginException, WSSecurityException, PasswordInvalidException, UserIDInvalidException,
AuthenticationFailedException, AuthenticationException, SystemLoginException,
com.ibm.portal.auth.exceptions.LoginException {
long startTime = System.currentTimeMillis();
long subTaskTime = startTime;
System.out.println("Entering CustomExplicitLoginFilter.login() ... Time Taken : " + (System.currentTimeMillis() - startTime) + " milli seconds");
chain.login(req, resp, userID, password, portalLoginContext, subject, realm);
System.out.println("User Authenticated ... Time Taken : " + (System.currentTimeMillis() - subTaskTime) + " milli seconds");
subTaskTime = System.currentTimeMillis();
List groupList = this.getUserGroups(req);
System.out.println("User groups retrieved ... Time Taken : " + (System.currentTimeMillis() - subTaskTime) + " milli seconds");
subTaskTime = System.currentTimeMillis();
if(this.isUserGroupAvailable(req, groupList, "wpsadmins") || this.isUserGroupAvailable(req, groupList, "wpadmins")){
System.out.println("Group Checked ... Time Taken : " + (System.currentTimeMillis() - subTaskTime) + " milli seconds");
subTaskTime = System.currentTimeMillis();
portalLoginContext.setRedirectURL("/wps/myportal/Administration");
System.out.println("URL created ... Time Taken : " + (System.currentTimeMillis() - subTaskTime) + " milli seconds");
subTaskTime = System.currentTimeMillis();
}
System.out.println("Exiting CustomExplicitLoginFilter.login(...) ... Time Took : "
+ (System.currentTimeMillis() - startTime) + " milli seconds");
}
public void destroy() {
// This is an empty implementation. No code required!!!
}
private List getUserGroups(HttpServletRequest request) {
List groupList = null;
try {
PumaProfile pumaProfile = pumaHome.getProfile(request);
com.ibm.portal.um.User user = pumaProfile.getCurrentUser();
PumaLocator pl = pumaHome.getLocator(request);
groupList = pl.findGroupsByPrincipal(user, false);
} catch(Exception exp){
exp.printStackTrace();
}
return groupList;
}
private boolean isUserGroupAvailable(HttpServletRequest request, List groupList, String userGroup) {
boolean groupFlag = false;
try {
List attribs = new ArrayList();
attribs.add("cn");
PumaProfile pumaProfile = pumaHome.getProfile(request);
for(Iterator group_itr = groupList.iterator();group_itr.hasNext();){
Group group = (Group) group_itr.next();
Map group_attribs = pumaProfile.getAttributes(group, attribs );
String group_cn = (String) group_attribs.get((Object)"cn");
System.out.println("group cn: " + group_cn);
if(group_cn.equals(userGroup)){
groupFlag = true;
break;
}
}
}
catch (Exception exp) {
exp.printStackTrace();
}
return groupFlag;
}
}
Step-by-step guide to Portal clustering
Installing and Clustering WebSphere Application Server (WAS) 7.0.0.5 and WebSphere Portal 6.1.5
Below are the major steps required to perform for Installing and clustering WebSphere Application Server and WebSphere Portal:
1. Install WebSphere Application Server Network Deployment 7.0.0.0 on the machine.
a. Select "None" during the step of creating a profile. WebSphere Portal will create its own WebSphere Application Server Profile later.
2. Update WebSphere Application Server to 7.0.0.5 level by installing respective fix pack. You can go to a higher version as well if available. Apply all available fixes as well. This is the minimum required. Apply both WAS and SDK fix packs.
3. Install Portal. Select "Full" install to install everything or "Administrative install" to install blank portal with only Administration Portlets. Apply any fix packs and fixes available to make sure that portal version is current and update with all the fixes.
4. Install Deployment Manager or create a new profile using "Profile Management Tool". Select "Management" and "Deployment Manager" in the profile sections. Install all fix packs and fixes as have been applied to WebSphere Application Server in the previous section to make sure that Deployment Manager and Application Server are on the same level if you are installing a fresh copy of Application Server for deployment manager.
5. Configure Deployment Manager, create a group called "wpsadmins", create exactly the same user as you have provided during the Portal installation and add this user to "wpsadmins" group.
6. Configure Portal for federation.
Following link provides a step-by-step guide to Portal clustering.
https://www-304.ibm.com/support/docview.wss?uid=swg21413946
Below are the major steps required to perform for Installing and clustering WebSphere Application Server and WebSphere Portal:
1. Install WebSphere Application Server Network Deployment 7.0.0.0 on the machine.
a. Select "None" during the step of creating a profile. WebSphere Portal will create its own WebSphere Application Server Profile later.
2. Update WebSphere Application Server to 7.0.0.5 level by installing respective fix pack. You can go to a higher version as well if available. Apply all available fixes as well. This is the minimum required. Apply both WAS and SDK fix packs.
3. Install Portal. Select "Full" install to install everything or "Administrative install" to install blank portal with only Administration Portlets. Apply any fix packs and fixes available to make sure that portal version is current and update with all the fixes.
4. Install Deployment Manager or create a new profile using "Profile Management Tool". Select "Management" and "Deployment Manager" in the profile sections. Install all fix packs and fixes as have been applied to WebSphere Application Server in the previous section to make sure that Deployment Manager and Application Server are on the same level if you are installing a fresh copy of Application Server for deployment manager.
5. Configure Deployment Manager, create a group called "wpsadmins", create exactly the same user as you have provided during the Portal installation and add this user to "wpsadmins" group.
6. Configure Portal for federation.
Following link provides a step-by-step guide to Portal clustering.
https://www-304.ibm.com/support/docview.wss?uid=swg21413946
Subscribe to:
Posts (Atom)