October 10, 2014

How to make an entry of host file in Unix

Below is the procedure to make an entry of host file in Unix

  • Open host file: /etc/hosts
  • Make an entry to the file like below
           <ip> <hostname>
           Ex:
             10.143.121.118  myhostname
  • Save the file
  • And run below command to flush the DNS cache
           dscacheutil -flushcache

October 7, 2014

ADF_FACES-30108:The view state of the page has expired because of inactivity. Reload the page.

I have several tabs in my portal application, in which some of them are loading data from web services. Some times when I click on those tabs, an alert message with the below error message is displaying and on-click of Ok button, the app is reloading.

The error message:

ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RESTORE_VIEW 1
javax.faces.application.ViewExpiredException: viewId:/oracle/webcenter/portalapp/pages/home.jspx - ADF_FACES-30108:The view state of the page has expired because of inactivity.  Reload the page.

Solution:

To ignore this error, I have written a filter which validates the app session on every navigation.  And my filter would look like,

package portal;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MyFilter implements Filter {
    private FilterConfig fc = null;

    public MyFilter() {
        super();
    }

    public void init(FilterConfig filterConfig) throws ServletException {
        fc = filterConfig;
    }

    public void doFilter(ServletRequest servletRequest,
                         ServletResponse servletResponse,
                         FilterChain filterChain) throws IOException,
                                                         ServletException {
        String reqSessionID =
            ((HttpServletRequest)servletRequest).getreqSessionIDId();
        String currentSessionID =
            ((HttpServletRequest)servletRequest).getSession().getId();
        String requestURI =
            ((HttpServletRequest)servletRequest).getRequestURI();
        boolean sameSession =
            currentSessionID.equalsIgnoreCase(reqSessionID);
        System.out.println("currentSessionID == reqSessionID? : " + sameSession);
        if (!sameSession && reqSessionID != null) {
              //((HttpServletResponse)servletResponse).sendRedirect(requestURI);
            System.out.println("Session is null");
        } else {
            filterChain.doFilter(servletRequest, servletResponse);
            System.out.println("Continue to servlet.");
        }
    }

    public void destroy() {
        fc = null;
    }
}

Configured the above filter in web.xml file as below.
<filter>
 <filter-name>AppSessionFilter</filter-name>
   <filter-class>portal.MyFilter</filter-class>
 </filter>
<filter-mapping>
  <filter-name>AppSessionFilter</filter-name>
   <servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

October 6, 2014

How to delete MDS content of an application?

Below steps tell you how to delete MDS content of an application from EM console. 
  • Login to weblogic EM console
  • Under the domain (on left hand side), expand "Metadata Repositories" and select the target MDS. In this example, it is "mds-SpacesDS"
                               
  • You can see the list of partitions under the section "Repository Partitions" 
  • Select the target partition
                    
  • Click on "Delete..." button on top of the list and confirm
  • MDS content of the partition will be deleted.