Set session timeout in Weblogic

There are two ways user's HTTP session timeout can be set for your web application.
1.       Web.xml
2.       Weblogic.xml

Please note in web.xml the session timeout is set in minutes.

In weblogic.xml the session timeout is set in seconds.

More importantly the timeout value set in web.xml takes precedence over weblogic.xml. If you don't set any values in web.xml, weblogic.xml takes over. I think it is better to handle session timeout in web.xml itself since web.xml takes precedence over application server’s deployment descriptors.

Drawbacks of Ajax

We all know how Ajax is important in today's world. Thanks to google. You can develop rich and interactive web/portal applications by using combination of Ajax, Java script, REST APIs. I am not against Ajax but I honestly think one should know when to use it and when NOT to use it. Here are some known limitations of using Ajax.
1. Not all browsers supports Ajax. Though IE 5.x, 6.x, Mozilla 1.x, Firefox still supports.
2. XMLHttpRequest is not supported in older version. No standardization of XMLHttpRequest yet.
3. Java Script code could be visible to a hacker.
4. UI developers must have JavaScript skills.
5. Ajax based applications are difficult to debug, test and maintain.
6. Toolkit/Frameworks are still maturing.
7. Lack of design patterns or best practices guidelines yet.
8. Server side developers need to understand, presentation logic is required both at client & server side as well.
9. Namespace collision is possible.

How to implement breadcrumb in Weblogic Portal

Breadcrumbs is one of the cool features of weblogic portal framework for UI navigation. We have successfully implemented this functionality for one our portal applications. The JSP is given below which is based on weblogic portal 10.2 version. I think it should work with weblogic portal 10.3 as well. Let me know if you are running into any issues with this JSP. This jsp should be included as part of page.jsp.

<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ page import="com.bea.netuix.servlets.controls.window.WindowPresentationContext,
<%@ page session="false"%>
<%@ taglib uri="" prefix="render" %>

    This is the JSP for the showing breadcrumbs in XYZ Eagle portal.
    It is part of the skeleton file page.jsp.

    Implementation based on WebLogic Portal 10.2.

    Author ::      Ananth Kannan

    ArrayList breadcrumbTitles = new ArrayList();
    ArrayList breadcrumbURLs = new ArrayList();
    boolean isHidden = false;

    BookPresentationContext book = BookPresentationContext.getBookPresentationContext(request);
    PagePresentationContext pageCtx = PagePresentationContext.getPagePresentationContext(request);

    if (!(book.getDefaultPage().equals(pageCtx.getDefinitionLabel())))
        PagePresentationContext parentPage = book.getParentPagePresentationContext();
        while (parentPage != null)

            if (parentPage instanceof BookPresentationContext)
                BookPresentationContext parentBook = (BookPresentationContext)parentPage;
                breadcrumbURLs.add(PageURL.createPageURL(request, response,  parentBook.getDefaultPage()).toString());
                breadcrumbURLs.add(PageURL.createPageURL(request, response, parentPage.getDefinitionLabel()).toString());
            parentPage = parentPage.getParentPagePresentationContext();

            //DO NOT SHOW BREADCRUMBS IN MAIN HOME PAGE and also in hidden page
            if (pageCtx.isHidden())
     <ul class="breadcrumbs">
        for (int i = breadcrumbTitles.size() - 1; i >= 0; i--)
            if (((String)breadcrumbTitles.get(i)).equalsIgnoreCase("My Main Book")) {
                    breadcrumbTitles.set(i, "My Home");
            <li class="first"><a href="<%=breadcrumbURLs.get(i) %>" ><%=breadcrumbTitles.get(i)%></a></li> <img src="<render:getSkinPath imageName="/arrow_right.gif" />" />&nbsp;  <%

Weblogic Portal Interview Questions - Latest

As the economy getting better day by day so is the job market. I am getting  number of requests from fellow readers and job seekers to put more interview questions in weblogic portal. Let's get into business straightaway. Some are simple, some are tricky and few are, you got it!

1. How do you integrate existing legacy applications, non-portal web applications into portal?
2. How can you show/hide portlets in your applications at run time?
3. What are the different ways to implement SSO in Weblogic portal?
4. What are the different ways to create portlet preferences in weblogic portal?
5. Have you used any iframe portlets?
6. What are the limitations of IFrame portlets from portal perspective?
7. Have you used AJAX in your portal ? What are the limitations?
8. Have you used WSRP? What are the limitations of WSRP?
9. How session handling is done in WSRP between consumer and producer? what are the different ways?
10. Have use used domain templates? How do you create them? What are the advantages of domain templates?
11. Different strategies of content propagation in weblogic portal?
12. How do you offer books, pages and portlets as remote in weblogic portal 10.3?
13. How do you do IPC (inter-portlet communication) between producer and consumer?
14. How do you expose Weblogic portlets as a URL?
15. How to show different look-and-feel for different users?
16. How to create custom layouts in weblogic portal?

Useful Links:

How to change from development mode to production mode in Weblogic 10.3

Some of you have requested how to change Weblogic start up mode from DEV to production or vice versa. Actually it is very simple. One way to change it is, by simply editing setDomainEnv.cmd which resides in $root_domain/bin folder.

1. Look for the line that sets the PRODUCTION_MODE script variable: set PRODUCTION_MODE
Add false to the value of the PRODUCTION_MODE variable to ensure the server starts in development mode:
 Set true for starting in prod mode.


2. Save your changes and exit the text editor.

Useful links:
How to create weblogic domain templates?
Difference between Dev mode and Prod mode

Federated Portal Vs Enterprise Portal

What is a federated portal?
 A federated portal is a portal that consumes resources such as remote portlets, books, and pages. These remote resources are collected and brought together at run time to a portal application called a consumer, which presents the federated portal to end users. So in federated portal, portal application and portlets will be running in different containers where as in local portal, both will be running in a single portal container.

A federated portal reflects a true Service Oriented Architecture(SOA). These individual remote parts basically called producers of a federated portal that can be maintained, updated, and released independently without redeploying the consumer portal in which they are surfaced. Lets say your organization has depts like sales, marketing, human resources and finance. Every department has its own budget, needs and resources. Sales dept doesn't need to worry about how finance portlets will look like though both portlets will be running under a portal consumer. Instead of building all portlets into a single portal applications, you can develop portlets for each dept separately and deploy portlets as seperate web applications running on remote servers while portal consumes them using WSRP. You can have producer for each department if you want to which will be easy to maintain. Federated portal uses WSRP(Web Services for Remote Portlets (WSRP) for decoupling portlets from portal.

Enterprise or (Local) portals are the one where all portlets will be developed, maintained and deployed in a single container. So small changes to the portal, you need to perform whole life cycle - design, development, testing, deployment and propagation to development to staging to production. This may be OK for small sized portal but as the portal grows maintenance becomes very difficult. For many organizations, the cost of such maintenance is significant and can include portal downtime. Federation simplifies portal maintenance.

P.S: All WebLogic Portal applications are, by default, both consumers and producers. This means that every WebLogic Portal application is capable of hosting remote portlets and consuming them. With a federated portal architecture, separate development teams, perhaps in separate business units, operating in different geographical locations, can focus on and develop their respective portlets. These development teams can update, test, and release their portlets independently from one another. You do not need to redeploy a federated portal every time a portlet deployed in aproducer changes. When a remote portlet is updated in a producer, all of the consumers of that portlet receive the change immediately and automatically.

How to Integrate web applications into Weblogic Portal

If you are a portal developer or portal architect working at client site for providing portal solutions, you will come across these questions. How will I integrate my existing web applications into portal? Or How do I bring all web applications into single user interface? How to provide a single point of access to existing applications so user just login only once? Well, there are many ways to do that. Lets take the simple approach first.

1. Links
Links portlets are one of the quickest ways to integrate with existing applications, though providing just links is not actual integration. Trust me, we have developed many links portlets for integration as it is quick to develop and not much coding is needed. But there is some disadvantage too as we are making users to jump into another applications.

2.IFrame portlet
Believe me we have developed iframe portlets as well. This is second most common way to quickly integrate an application into a portal. By using <iframe> html tag in a portlet we can reference the application. When we do so, application will be displayed under portal with portal banner and portal navigation. But there are some downsides to it too. Timesouts can be tricky because either the Iframes or portal can timeout before the other. There could be an issue with look-and-feel as well. The iframe tag can introduce scroll bars.

3. Web clipper portlets:
This is another option for integrating any web application with portal. Web Clipping enables the clipping of an entire web page or a portion of it and reusing it as a portlet. Basic and HTML-form-based sites may be clipped. Use web clipping when you want to copy content from an existing web page and expose it in your portal application as a portlet.

4. WSRP portlets:
Another approach is using WSRP - Web Services for Remote portlets. These portlets provide both presentation and business logic which is slightly different than standard web service which provides only business logic no presentation so every client had to implement on their own. To understand better, compare with HTTP where user interacts with remote servers by using browser and doing operation like form submitting. He gets his response as HTML in the browser. WSRP is a similar protocol between server and client. In WSRP terminology, the server is called a producer. It hosts services, typically portlets, that clients, or consumers, communicate with. Consumers uses WSRP which defines a common, well defined interface that defines how a portal(consumer) should interact with producer. WSRP is built upon existing Web services standards like SOAP, WSDL, and UDD. WSRP can aggregate portlets from more than one producers into single page and can apply consumer specific look-and-feel to that page.

5. Struts portlets:
Lets say you have existing struts application up and running some where obviously outside portal and you would like to host in the portal. Weblogic portal provides struts portlets by which you can integrate with existing struts applications.

Error code 413 in Weblogic

Sometimes if you have MaxPostSize set in Apache configuration(httpd.conf) to lower number such as 2048 bytes, you may get into error 413 when you perform operations such as file upload, data transfer from the browser. I had this issue for some of my applications deployed in weblogic server 10.3 with Apache proxying the requests.

You might want either increase the size or remove it completely. if you don't mention it will take default integer which is -1. this means unlimited size.
<Location /app1>
       SetHandler weblogic-handler
       WebLogicHost localhost
       WebLogicPort 7001
       WLCookieName cookie1
       DynamicServerList OFF
       MaxPostSize     2048
       Debug ALL
       WLLogFile logs/proxy.log

Useful links:

If you would like to know how to integrate Apache with Weblogic, please visit this blog.