Thursday, March 17, 2016

Apache Web Server 2.2.31 installation on unix host

In this post, I will talk about the how to build/install apache web server from the source and install it on a unix machine (RHEL in my case).
tar -zxvf httpd-2.2.31.tar.gz

./configure --prefix=/opt/apache-2.2/apache_2.2.31 --enable-mods-shared=all --enable-proxy --enable-expires --enable-vhost-alias

configure: error: no acceptable C compiler found in $PATH

yum install gcc
yum install zlib-devel

make

make install

mount -o remount,noexec /tmp/

/usr/sbin/groupadd oinstall

/usr/sbin/useradd -g oinstall oracle

passwd oracle

export LD_LIBRARY_PATH=/oracle/apps/webgate/webgate/apache/lib/

./deployWebGateInstance.sh -w /oracle/apps/webgateinstance -oh /oracle/apps/webgate -ws apache


Monday, October 19, 2015

OIM 11G R2 Server Performance Tuning

In this post, I will list some of the server tuning parameter that can be used to tune oim managed server.

JVM Memory

For Hotspot JVM

Min Heap Size(Xms) = 4GB, Max Heap Size(Xmx) = 8GB, PermSize(-X:PermSize) = 500m and PermGen size (-XX:MaxPermSize) = 1 GB.

For JRockit JVM

Min Heap Size(Xms) = 4GB, Max Heap Size(Xmx) = 8GB, PermSize(-X:PermSize) = N/A and PermGen size (-XX:MaxPermSize) = N/A


To change the JVM memory setting:
1. If your OIM version is 11.1.2.1.0 or above, use DOMAIN_HOME/bin/setOIMDomainEnv.sh
(Unix) or setOIMDomainEnv.cmd (Windows). If not, continue to use
DOMAIN_HOME/bin/setDomainEnv.sh (Unix) or setDomainEnv.cmd (Windows) to
change the heap size settings.
2. Change the value of DEFAULT_MEM_ARGS and PORT_MEM_ARGS from the default value and
save.
3. Restart OIM Server



Saturday, October 17, 2015

OIM 11G R2 PS2 (11.1.2.2.X) Submit Buttion Action Listener Sample Code

In this post , I will be sharing some sample code related to submit action listener that gets invoked every time you hit the submit button on the request page.

---------------------------------------------------------------------------------------------------------------------






package deepak.dubey.com;

import java.text.SimpleDateFormat;

import java.util.Date;

import javax.el.MethodExpression;

import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

public class CustomReqBean {
    public CustomReqBean() {
        super();
    }
    
    
    private UIComponent startDateID;
    private UIComponent endDateID;
     
    public void setStartDateID(UIComponent startDateID) {
        this.startDateID = startDateID;
    }
     
    public UIComponent getStartDateID() {
        return startDateID;
    }
     
    public void setEndDateID(UIComponent endDateID) {
        this.endDateID = endDateID;
    }
     
    public UIComponent getEndDateID() {
        return endDateID;
    }
    
    private static final String START_DATE_END_DATE_VALIDATION_MSG = "Start Date - End Date interval cannot exceed 180 days for Contractors.";
        private static final String START_DATE_AFTER_END_DATE_VALIDATION_MSG = "Start Date cannot be before Today's Date.";
     
        private static final String USER_TYPE_ATTRIBUTE = "usr_emp_type__c";
        private static final String START_DATE_ATTRIBUTE = "usr_start_date__c";
        private static final String END_DATE_ATTRIBUTE = "usr_end_date__c";
    private static final String STATUS_ATTRIBUTE = "usr_status";
        
        
        
    public void submitButtonActionListener(ActionEvent e){
        int integer = 0;
        try{
            String cs3 = FacesUtils.getValueFromELExpression("#{backingBeanScope.catReqBean.cartItemSize}", String.class);
            integer = Integer.parseInt(cs3);
            
        }catch(Exception e1){
            e1.printStackTrace();
        }
        
        String edateStr = "";
        try{
            edateStr = FacesUtils.getValueFromELExpression("#{bindings.executionDate}", String.class);
            
        }catch(Exception e2){
            e2.printStackTrace();
        }
        
        Date d = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String todaysString = sdf.format(d);
        if(integer > 1){
            FacesMessage fm = new FacesMessage();
            fm.setSeverity(FacesMessage.SEVERITY_ERROR);
            fm.setSummary("More than 1 role");
            FacesUtils.showFacesMessage(fm);
        }else if(!(edateStr.equalsIgnoreCase(todaysString))){
            FacesMessage fm = new FacesMessage();
            fm.setSeverity(FacesMessage.SEVERITY_ERROR);
            fm.setSummary("Effective Date == today date");
            FacesUtils.showFacesMessage(fm);
        }else{
            MethodExpression originalActionListener = FacesUtils.getMethodExpressionFromEL("#{backingBeanScope.cartReqBean.submitActionListener"
                                                                                           null,new Class[]{ActionEvent.class});
            originalActionListener.invoke(FacesUtils.getELContext(), new Object[]{e});
        }
            
    }
        public void validator(FacesContext facesContext, UIComponent uiComponent, Object object) {
            if (uiComponent.equals(startDateID)) {
                // get value of End Date through binding
                oracle.jbo.domain.Date jboEndDate = FacesUtils.getAttributeBindingValue(END_DATE_ATTRIBUTE, oracle.jbo.domain.Date.class);
                // only validate if both Start Date and End Date are set
                if (jboEndDate != null) {
                    // value of Start Date is passed to validator
                    Date startDate = ((oracle.jbo.domain.Date)object).getValue();
                    Date endDate = jboEndDate.getValue();
                    validateStartDateEndDate(facesContext, uiComponent, startDate, endDate);
                }
            } 
            
//            else if (uiComponent.equals(endDateID)) {
//                // get value of Start Date through binding
//                oracle.jbo.domain.Date jboStartDate = FacesUtils.getAttributeBindingValue(START_DATE_ATTRIBUTE, oracle.jbo.domain.Date.class);
//                // only validate if both Start Date and End Date are set
//                if (jboStartDate != null) {
//                    Date startDate = jboStartDate.getValue();
//                    // value of End Date is passed to validator
//                    Date endDate = ((oracle.jbo.domain.Date)object).getValue();
//                    validateStartDateEndDate(facesContext, uiComponent, startDate, endDate);
//                }
//            }
        }
     
        private void validateStartDateEndDate(FacesContext facesContext, UIComponent uiComponent, Date startDate, Date endDate) {
            Date startDatePlus180Days = new Date(startDate.getTime() + 180L * 24 * 60 * 60 * 1000);
            java.util.Date todaysDate = new Date();
            
            if (!("Active".equalsIgnoreCase(FacesUtils.getListBindingValue(STATUS_ATTRIBUTE, String.class)))){
                if(startDate.before(todaysDate)){
                    facesContext.addMessage(uiComponent.getClientId(facesContext),
                                            new FacesMessage(FacesMessage.SEVERITY_ERROR, START_DATE_AFTER_END_DATE_VALIDATION_MSG, null));
                    
                    
                    
                }
            }else if("Active".equalsIgnoreCase(FacesUtils.getListBindingValue(STATUS_ATTRIBUTE, String.class))){
                facesContext.addMessage(uiComponent.getClientId(facesContext),
                                        new FacesMessage(FacesMessage.SEVERITY_ERROR, "Start Date cannot be modified for Active Users"null));
            }else  {
                // re-render -- in case there was an error message in queue for any of the two components it will be released
                FacesUtils.partialRender(startDateID);
                FacesUtils.partialRender(endDateID);
            }
   
            
            
//            if (startDate.after(endDate)) {
//                // queue error message for the component which is being validated (either Start Date or End Date)
//                facesContext.addMessage(uiComponent.getClientId(facesContext),
//                                        new FacesMessage(FacesMessage.SEVERITY_ERROR, START_DATE_AFTER_END_DATE_VALIDATION_MSG, null));
//            } else if (isContractorUserTypeSelected() && startDatePlus180Days.before(endDate)) {
//                // queue error message for the component which is being validated (either Start Date or End Date)
//                facesContext.addMessage(uiComponent.getClientId(facesContext),
//                                        new FacesMessage(FacesMessage.SEVERITY_ERROR, START_DATE_END_DATE_VALIDATION_MSG, null));
//            } else {
//                // re-render -- in case there was an error message in queue for any of the two components it will be released
//                FacesUtils.partialRender(startDateID);
//                FacesUtils.partialRender(endDateID);
//            }
        }
     
        public boolean isContractorUserTypeSelected() {
            // return true if value of "usr_emp_type__c" binding attribute equals to "Contractor"
            // "usr_emp_type__c" binding attribute is used to display value of User Type in the User Type drop-down
            return "Contractor".equals(FacesUtils.getListBindingValue(USER_TYPE_ATTRIBUTE, String.class));
        }
}



Friday, October 16, 2015

OIM and OIA SSL Setup and keytool and orapki commands


keytool -importcert -alias youranyaliasname -trustcacerts -file /tmp/deepak/dubey/filename.pem -keystore /tmp/deepak/dubey/mycustomkeystore.jks

on oim admin console
hostname verification to none

update xlconfig.xml to t3s and ssl port

copy 3 jar files
webservices+ssl.jar
jcryptoj.jar

change the keystores in OIA weblogic from the demo keystores to OIM's custom keystores

OHS to OIM mod_wl_ohs.conf

<Location /identity>
SetHandler weblogic-handler
WLCookieName oimjsessionid
WebLogicHost deepak.dubey.com
WebLogicPort 14001
Debug ALL
SecureProxy ON
WlSSLWallet "/tmp/deepak/dubey/wallets/ohs_proxy_ssl_wallet"
WLIOTimeoutSecs 600
Idempotent OFF
WLSRequest ON
WLProxySSL ON
WLProxySSLPassThrough ON
</Location>


change ssl.conf

SSLWallet "/tmp/deepak/dubey/wallets/ohswallet"

./orapki wallet create -wallet /tmp/deepak/dubey/wallets/ohswallet -auto_login_only

./orapki wallet add -wallet /tmp/deepak/dubey/wallets/ohswallet -dn CN=hostname -keysize 2048 -self_signed -validity 3650 -auto_login_only

./orapki wallet create -wallet /tmp/deepak/dubey/wallets/ohs_proxy_ssl_wallet -auto_login_only

./orapki wallet add -wallet /tmp/deepak/dubey/wallets/ohs_proxy_ssl_wallet -trusted_cert -cert RootCA.txt -auto_login_only

./orapki wallet add -wallet /tmp/deepak/dubey/wallets/ohs_proxy_ssl_wallet -trusted_cert -cert HostNameSelfSigned.txt -auto_login_only


keytool -importcert -alias OHS -file OIM-Server.cert -keystore /tmp/deepak/dubey/config/keystores/appTrustKeyStore-hostname.jks

keytool -export -alias myAliasName -file /tmp/deepak/dubey/myAliasName.txt -keystore /tmp/deepak/dubey/config/KeyStores/appIdentityKeyStore.jks -rfc


keytool -export -alias RootCA -file /tmp/deepak/dubey/RootCA.txt -keystore /tmp/deepak/dubey/config/KeyStores/appTrustKeyStore-hostname.jks -rfc

Wednesday, October 14, 2015

OIM OIA 11G R2 PS2 Integration Issue

If you have integrated OIM and OIA and they are in the different domain then you will encounter the issue while running the import jobs.

We need to establish trust between the 2 domains as below .

Navigate to Home > Domain > Security, and check Cross Domain Security is Enabled.


Click Advanced, enter the desired password in the Credential and Confirm Credential fields, and click Save.


Repeat this configuration change for both domains using the same password value.


Restart both Oracle WebLogic Servers.