How to Upgrade Dojo in IBM WebSphere Portal v8.0


How to upgrade dojo without changing existing dojo in IBM WebSphere v8.0.



IBM WebSphere Portal v8.0 provides ready-to-use dojo like v1.4.3, v1.6 and v1.7 (v1.7.2). IBM WebSphere v8.5 comes with a newer version of dojo, but to use newer version of Dojo like 1.8.x in WebSphere v8.0, there are no upgrade fixes available. The only way we can upgrade dojo is by customizing a newer dojo release. 


This blog is targeted for WebSphere users but the concept can be used or leveraged by other open source technologies too. The steps described below are using IBM RAD and IBM Portal Server v8. 


Following steps describes how to use customized dojo at the theme level but, can also be used at the page level.


Step #1 Download Dojo

Download the Dojo released version from the Dojo site.  

  1. Go to the http://download.dojotoolkit.org/release-1.8.5/
  2. Click on dojo-release-1.8.5-src.zip and save it to a temp directory.
  3. Unzip the downloaded zip file.


Step #2 Create a Web Project

Create a Web Project on IBM RAD and follow below steps.

  1. Create a new Web Dynamic Project (For ex: CustomDojo185).
  2. Create a “dojo” folder under the WebContent folder in the project.
  3. Copy the unzipped dojo files into the WebContent/dojo folder (dojo folders like dojo, dojox and dijit which contain all dojo related files). This web project can be deployed into the portal server from RAD as run on server.
Once the project is created, deploy it to the server (i.e. Run on server from RAD). The project can also be deployed exporting as war/ear. Once deployed successfully, check whether it is working or not on the browser.


For ex: type a URL like http://localhost:10039/CustomDojo185/dojo/dojo/dojo.js. It should load the dojo.js file on the browser or launch a pop up to save it.


Step #3 Update Theme Files

In this step, we are integrating customized dojo at the theme level so that it can be available to all the portlets and pages and easy to manage.


To access custom dojo from WebSphere, we have to change the theme locale (theme_<locale>.html) files and the metadata properties file using WebDAV. The theme locale files are located under the “nls” folder. For English locale we can change the theme_en.html. Connect to WebDAV resources using fs- type1 to access these theme files.  


Add the following javascript source to point to the new dojo after the “co:head” ( i.e. <link rel=”dynamic-content” href=”co:head”> tag in theme_en.html).


<script type=”text/javascript” src=”/CustomDojo185/dojo/dojo/dojo.js”></script>


Deploy the changes (using WebDAV).


Note: starting “/” forward slash is required in src attribute.


Next, connect to the WebDAV resources using ThemeList, and find metadata.properties. Update the metadata file setting profile to lightweight profile. Check profiles under the profile folder in WebDAV resources.

For ex:
resourceaggregation.profile=profiles/profile_lightweight.json


Note: There are two metadata.properties file, one is in Theme list and one is in fs-type1 WebDAV resources. Both (or at least in themelist) should be updated otherwise it won’t work.


If we need to use different dojo versions on different pages, then set the page parameters like resourceaggregation.profile=profiles/profile_lightweigth.json on the page where we need to use custom dojo. This will customize the dojo version at the page level.


Step #4 Validate Dojo

Once the custom dojo web application is deployed on the server as well as the Themes files and metadata.properties file changes deployed using WebDAV, test it on portal.
  1. Open Firefox browser and open Firebug console.
  2. Login and navigate to the page where the theme has been assigned.
  3. The Dojo files will be loaded from the custom dojo web application.
  4. To check it another way, type and run dojo.version, and dojo.baseUrl commands in the command area of Firebug console. It should print the new version of dojo and the base URL location is the new Dojo web application.
Note: Make sure there shouldn’t be any dojo related errors generated by the application.


Troubleshooting
  1. ibmConfig or ibmCfg is not defined : Basically this error only occurs when the theme can’t find the required modules. If we don’t use the “co:head” dynamic content tag on theme_<locale>.html file, the theme will not register the required and dependent modules. ibmCfg must be created while loading the theme and dojo. This variable (json object) sets all the required data for dojo and the theme, which will be used by the portal server to manage it
  2. i$ is not defined or reference error: Similar to above, this error occurs when the theme’s modules are not registered.
  3. Define already define error: This error only occurs when we set JavaScript src variable to dojo.js (For ex: <script src=”CustomDojo185/dojo/dojo/dojo.js”). This indicates that the page loads two dojo.js files at the same time and both of the dojo files tries to declare the same variables twice.   To fix this error, check the profile set in the metadata.properties file in WebDAV (fs-type1) and in the ThemeList resources. The profile should be lightweight. Lightweight profiles only include the minimum required modules, which is a benefit of using customized dojo run times.



Resources

Check following links for more detailed understanding.


Comments

Popular posts from this blog

SVN plugin setup in IBM RAD8 - Checkout project from SVN

Dojo Enhanced Grid with Checkbox like radio button exmaple