Showing posts with label WebSphere Portal. Show all posts
Showing posts with label WebSphere Portal. Show all posts

Identifying list of portlets on a page

There might be some scenarios where you want to get list of all the portlets on a portal page.
Following code snipped would be helpful for you to get list of portlets on a page.


private void listPortletsOnPage(ContentModel model, RenderRequest request, RenderResponse response) {

        try {
            ContentModel model = getContentModel(request, response)
            Locator locator = model.getLocator();
            ObjectID oID = PortletURLHelper.getCurrentPage(request, response);
            ContentPage cPage = (ContentPage)locator.findByID(oID);
            PrintWriter out = response.getWriter();

            List allPortlets = getPortletsOnPage(model, cPage);

            Iterator it = allPortlets.iterator();

            while(it.hasNext()){
                PortletWindow window = (PortletWindow)it.next();
                out.print("PortletWindow " + window.getObjectID() + "
");
            }
        } catch (StateException e) {
           
            e.printStackTrace();
        } catch (NamingException e) {
           
            e.printStackTrace();
        } catch (IOException e) {
           
            e.printStackTrace();
        }

    }
       
   
    private ContentModel getContentModel(RenderRequest renderRequest, RenderResponse renderResponse) {
   
        try {
            ContentModelProvider provider = (ContentModelProvider) psh.getPortletService(ContentModelProvider.class);
            return provider.getContentModel(renderRequest, renderResponse);
        } catch (PortletServiceUnavailableException e) {
           
            e.printStackTrace();
        } catch (ModelException e) {
           
            e.printStackTrace();
        }

        return null;

    }
   
       
    public List getPortletsOnPage(final ContentModel aContentModel, final ContentPage aPage) {
        List result = Collections.EMPTY_LIST;
        final LayoutModel aLayoutModel = aContentModel.getLayoutModel(aPage);
        if (aLayoutModel != null) {
            result = new ArrayList();
            try {
                collector(aLayoutModel, aLayoutModel.getRoot(), result);
            } catch (ModelException e) {
                e.printStackTrace();
            }
        }
        return result;
    }

Enabling WebSphere Portal run time log

To debug any portal or portlet related issues, you might want to get into detailed log analysis of your portal environment.

By enabling Portal run time logs, you can debug issue with Portlet Container, Portlet Environment, Portlet Load Monitoring, Deployment and of various types.

Have a look various logs level options, you can turn on for your portal environment.

Enabling WebSphere Portal Run time logs

WASX7070E: The configuration service is not available.


I was trying to register portlet services on WAS console using jython script.
Script worked well in my local portal environement and but in some of the env I was getting following exception
WASX7070E: The configuration service is not available.

Just wanted to share the solution that I found and hope it may help and would save time...

When you are running a script which takes one of the argument as SOAP_CONNECTOR_ADDRESS, you may find this kind of error..(WASX7070E:....)

First, to know SOAP_CONNECTOR_ADDRESS value, please Login to WAS Console

click on Servers, then
Server Types, then
WebSphere application servers, then
WebSphere_Portal, then
expand the port section ( right bottom side under Communications heading)
look for the port value of SOAP_CONNECTOR_ADDRESS. 

Now, take look at  the \AppServer\profiles\AppSrv01\properties\wsadmin.properties and look for value for com.ibm.ws.scripting.port

Next, open WAS console and navigate to ports as shown below
Application servers > server1 > Ports

Verify that, SOAP_CONNECTOR_ADDRESS port number should be set to com.ibm.ws.scripting.port in wsadmin.properties.
IF NOT, try running your command with the com.ibm.ws.scripting.port value specified in wsadmin.properties file.

Identifying WPS, WAS ports for your portal environment


 This post specially talks about identifying port details for your Portal, WAS environment.
You can find all ports related and other portal, WAS related useful information inside serverindex.xml file.

Find serverindex.xml file located under
<wp_profile>\config\cells\portalCell01\nodes\portalNode01\serverindex.xml

There will be two serverEntries tag in serverindex.xml file.
One for WebSphere_Portal and other for server1

Example:-

WebSphere Portal entry in serverindex.xml 
<serverEntries xmi:id="ServerEntry_1183122129640" serverName="WebSphere_Portal" serverType="APPLICATION_SERVER">

Server1 entry in serverindex.xml
 
<serverEntries xmi:id="ServerEntry_1257635939012" serverName="server1" serverType="APPLICATION_SERVER">

For WebSphere Portal - search for   serverName="WebSphere_Portal"

To find out port for WPS http and https port

http port - search for  "WC_defaulthost"

https -     search for  "WC_defaulthost_secure"

For server1 - search for   serverName="server1"

To find out details about server1 http and https ports, search inside servername="server1"

WTRN0086I: XAException encountered during prepare phase for transaction

We have faced below exception while making asynchronous call using JMS.

An illegal attempt to commit a one phase capable resource with existing two phase capable resources has occurred.

you may also get this exception in same or with some other scenarios...

I opened a PMR with IBM and this was their solution...
thought of sharing with this post which may be useful for you as well

Exception:-

An illegal attempt to commit a one phase capable resource with existing two phase capable resources has occurred.
[03/08/10 09:58:34:536 BST] 00000089 RegisteredRes E   WTRN0086I: XAException encountered during prepare phase for transaction 0000012A372C727A0000000200011FD71BD27FE89D21CD8689A08EBFBF1210F21271F6660000012A372C727A0000000200011FD71BD27FE89D21CD8689A08EBFBF1210F21271F66600000001. Local resources follow.
[03/08/10 09:58:34:540 BST] 00000089 JTAResourceBa I   WTRN0089I: LocalTransactionWrapper@:98e2e9  localTransaction:com.ibm.ws.rsadapter.spi.WSRdbSpiLocalTransactionImpl@cd96a1  enlisted:true  registeredForSynctruemcWrapper.hashcode()3184943: Vote: none.



FIX:-

Login to WAS as an Admin and

click Servers > Application Servers > server_name

Look at the properties of the application server in the content pane.

Under Container Settings, expand Container Services and click Transaction Service to display the properties page for the transaction service.

Under Additional Properties click Custom Properties.

On the Custom Properties page, click New.

Type ACCEPT_HEURISTIC_HAZARD in the Name field and type TRUE in the Value field.

Click Apply or OK. Click Save to save your changes to the master configuration.

Restart the server.

EJPIC0067E: Portal requires fully-qualified hostname that is recognized by the DNS server.

While installing portal, you may find below error while providing hostname


EJPIC0067E: Portal requires fully-qualified hostname that is recognized by the DNS server.Enter hostname again.


You will find these instruction to say about 
Enter the fully qualified host name for the server, for example: hostname.example.com. Do not use a local host or a loopback address.


To resolve this problem, make an entry of hostname in host file location under C:\WINDOWS\system32\drivers\etc


Open file called hosts and make an entry like


127.0.0.1 www.extremeportal.com


Save file.


Now again try installing portal and provide www.extremeportal.com as hostname.
You should be able to proceed with your portal installation afterwards.

IBM WebSphere Portal channel on YouTube

Yes, WebSphere portal demos can now be seen on youtube with new IBM WebSphere Portal channel on YouTube.
You will find videos that are industry specific and for accelerators too. You can also subscribe to the channel to find out about the latest videos.

IBM WebSphere Portal YouTube channel


Translating public URL to protected URLs

This post talks about when you have portal user session exists for anonymous users and of course that time user will be accessing unprotected pages and portlets.
This time portal url will be like .../wps/portal/......

Now you want that, as soon as user tries to access any protected url during this journey, the portal url should automatically change to ../wps/myportal/...

configuration service property uri.home.substitution determines whether a public URL should be translated to a protected URL if a user session exists.

to do this...perform following steps...

1.Launch Deployment Manage Console and Login as wpsadmin.
2.Goto Resouces -> Resource environment -> Resource environment providers -> WP ConfigService -> Custom Properties.
3.Add this property uri.home.substitution = true


Impersonation feature in WebSphere Portal

The Impersonation feature allows a user such as a support specialist to access a user's system to test out a new page, portlet, etc. and to see any issues as they occur on the end user system. Portal Access Control controls the ability to impersonate another user. To be able to impersonate another user, you need to have Delegator@User access. You first need to enable the impersonation feature within IBM® WebSphere® Portal.

Have a look here to see
How to enable Impersonation feature in WebSphere Portal

WCM Best Practices: naming conventions

In one of my assignment, I got a chance to work with WCM team partially.
At the initial stage, we had been looking for some best practice to have good
naming conventions for WCM components and on of the mentioned blog article helped us to provide very useful information.

I just thought of sharing here with you all.

If you are also in the early stage of WCM, and looking for naming conventions for WCM compoents, i would suggest to have a look here before



WCM Best Practices: naming conventions

Creating custom themes and skin in WebSphere Portal 6.1.x

Creating custom themes and skins in websphere portal are easy but we should aware of which is best practice and easy to maintain.
I had an experience of creating theme by manually creating a new folder ( of desired name for new theme) under

was_profile_root/installedApps/cellname/wps.ear/wps.war/themes/markup

directory and then copy existing theme content to new theme folder and then finally make changes to required jspf, css, images as per business need.

But, creating a new theme by this approach doesn't come under best practice, because it requires you to export wps.war, update the war.war file and then again deploying the updated wps.war file.
So anytime if you want to make any changes, you will require to update and redeploy wps.war file.This made developing and managing custom themes and skins difficult.

Best Practise for creating custom themes and skins
With WebSphere portal 6.1, new themes and skins should be packaged in their own war file, or optionally ear file.Once you are done with packaging your theme into a war file, the theme war is deployed to WebSphere_Portal application server or cluster via WebSphere admin console.

So, here i am writing steps to create basic custom theme just to have header and footer. (You can later on enhance your theme as needed.)

1) In RAD, create a Dynamic Web Project.

2) Crate folder called themes and skins under webcontent

3) create html folder under themes.

4) create folder for your new theme ( ex:- MyTheme)

5) Create basic 3 jsp called Default.jsp, Header.jsp and Footer.jsp

6) Put your required css, images and js files on your file system and include them in your default.jsp.
( In actual dev, stag or prod portal, these css, images and js files should be placed on WebServer and then make change to path of img,css,js in default.jsp accordingly)

7) Put your header html section in Header.jsp and required footer html to Footer.jsp

8) Include, Header.jsp and Footer.jsp into Default.jsp.
( put tag <portal-core:screenRender/> in default.jsp, in between inclusion of header and footer jsp to render your portlets)

9) Export your project as war.

10) Deploy war to WebSphere Portal Application Server.
( Be sure to select WebSphere Portal in "Map modules to servers" step.
Once it is deployed, start your theme application and if it's clustered env, don't forget to sync your nodes.)

11) Next step will require to tell portal about new theme.
Go to PortalServer/doc/xml-samples/DeployThemeFromWebModule.xml
Make changes to DeployThemeFromWebModule.xml and import it back to portal from Portal Administration.

12) Verifying new theme. You should now see you new theme entry inside Themes and Skins section in portal admin.
and that's it, you are good to go. Create a new page and apply your theme.

Feel free to post comment if you have face any trouble in creating and deploying custom theme.

Enhanced Site Analytics in WPS 6.1.5

For one of my assignment, i worked with site analytics in portal 6.1 , and struggled to show analytics data in good presentation format, because enabling site analyzer creates sa.log file and then you can write your own portlet to read data and show it in a graphical presentable format as per business need.

I also tried integrating external web analytis tools like AWStats with portal and got success but not satisfactory results as per business need.

With Portal 6.1.5, IBM has enhanced site analytics and easy integration of
  • Coremetrics analytics,
  • Webtrend analytics,
  • Omniture SiteCatalyst


get download of PortalSiteAnalyticsFinal to read in detail

Manually restore the wps.ear application

It's been long back i faced a problem where i was required to restore wps.ear, that time i was not aware of any technote that describes steps to manually restore wps.ear.
Now i found one technote that shows steps to manually restore wps.ear, here with this post i though of sharing this technote which might be useful for anyone....
Manually restore the wps.ear application

Integrating RIA controls into WebSphere Portal

I was just randomly broswing and reading IBM websphere portal tehnotes, and came across with an excellent new thing where in we can integrate Rich Internet Applications controls into WebSphere Portal.

Here RIA controls referes to like Flex controls that we can integrate into portlets that are based on JSR286 specification.
Read out in detailed article here
Integrating Rich Internet application (RIA) controls into IBM WebSphere Portal
If you look at the Resources section at the end of this article, you will also find very good articles specially on how to integrate Flex, Ajax and JSR286 portlets.
Thanks to Adam and Peter for such a wonderful article.

40 sites that use IBM Lotus WCM in production

Here you will find a resource relating to a list of 40 public web sites that use IBM Lotus Web Content Management (LWCM) in production. Some of them are entirely implemented with LWCM, others are built on WebSphere Portal, where pages contains Local (or Remote) Rendering Portlets, linked to a WCM content
The resource is a french blog entry:

Automatic portlet maximization

In earlier versions of WebSphere Portal, the state of a portlet was automatically set to maximize when the portlet mode was changed from view mode to another mode. For example, when switching to edit mode, the portlet would be changed to maximized state until the user changed back to view mode. This automatic maximize behavior has been removed by default, but can be implemented at the following levels.

Portal level
To configure all portlets to automatically maximize when the mode is changed, set the portlet.automaximize configuration service parameter to true for portal configuration serviceIf you set this to true, the portlet window is maximized when a portlet is set into edit, configure or help mode.


Skin level
This behavior can be implemented in portlet skins, using the <portal-navigation:urlGeneration/> tag, so that the administrator can control which portlets are automatically maximized. For example, you could create a skin called PortletWindow_Normal_Skin and a skin called PortletWindow_Max_Skin, with the only difference between the two is that PortletWindow_Max_Skin is used to automatically change the portlet state when the portlet enters another mode other than View.

Portlet level - for IBM portlets
To configure specific portlets to automatically maximize, the portlet developer can com.ibm.portal.automaximize initialization parameter to true. See Reserved parameter names for more information.

Portlet level - JSR 168 portlets
In JSR 168, you can specify portlet window state while created actionurl to portlet.so, from within your doEdit method you can write this code to maximze window state when user goes to personalize mode of portlet.

PortletURL portletURL = renderResponse.createActionURL();
portletURL.setWindowState(WindowState.MAXIMIZED);