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.

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.

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

Sponsor Advertisement