Saturday, 18 July 2015

Updating portal/wcm properties via config engine tasks

Websphere portal maintains lot of configurations in property files and resource environment entries. One way to edit them is via logging into was console other way is to edit the property files. Values in was console rep entries will take higher order than property files.If you want to modify large number of values in property files then you can perform the changes and run appropriate task based on properties belong to portal or wcm config.


For changes to WebSphere Portal properties files to take effect, run the following task from the  wp_profile_root/ConfigEngine directory.
Windows: ConfigEngine.bat update-properties -DPortalAdminPwd=password -DWasUserid=username -DWasPassword=password
AIX® Linux Solaris: ./ConfigEngine.sh update-properties -DPortalAdminPwd=password -DWasUserid=username -DWasPassword=password
IBM i: ConfigEngine.sh update-properties -DPortalAdminPwd=password -DWasUserid=username -DWasPassword=password
z/OS: ./ConfigEngine.sh update-properties -DPortalAdminPwd=password -DWasUserid=username -DWasPassword=password

For changes to Web Content Manager properties files, run the following task from the wp_profile_root/ConfigEngine directory.:-
Windows: ConfigEngine.bat update-wcm-service-properties -DPortalAdminPwd=password -DWasUserid=username -DWasPassword=password
AIX Linux Solaris: ./ConfigEngine.sh update-wcm-service-properties -DPortalAdminPwd=password -DWasUserid=username -DWasPassword=password
IBM i: ConfigEngine.sh update-wcm-service-properties -DPortalAdminPwd=password -DWasUserid=username -DWasPassword=password
z/OS: ./ConfigEngine.sh update-wcm-service-properties -DPortalAdminPwd=password -DWasUserid=username -DWasPassword=password

List of possible configuration parameters :- 

WebSphere Portal serviceService name in the WebSphere Integrated Solutions ConsoleWebSphere Portal properties file
Administrator Unique Names Mapping ServiceWP AdminUniqueNamesMappingServiceAdminUniqueNamesMappingService.properties
Cache Manager ServiceWP CacheManagerServiceCacheManagerService.properties
Common Component Configuration ServiceWP CommonComponentConfigServiceCommonComponentConfigService.properties
Configuration ServiceWP ConfigServiceConfigService.properties
CP Configuration Service for tagging and ratingWP CPConfigurationServiceCPConfigurationService.properties
Content Access ServiceWP PortletServiceRegistryService
See Content Access Service.
PortletServiceRegistryService.properties
See Content Access Service.
Data Store ServiceWP DataStoreServiceDataStoreService.properties
Deployment ServiceWP DeploymentServiceDeploymentService.properties
HTTP Client ServiceWP HTTPClientServiceHTTPClientService.properties
Live Object ServiceWP LiveObjectServiceLiveObjectService.properties
Loader ServiceWP LoaderServiceLoaderService.properties
Localizer ServiceWP LocalizerServiceLocalizerService.properties
Model WebDAV ServiceWP ModelWebDAVServiceModelWebDAVService.properties
Navigator ServiceWP NavigatorServiceNavigatorService.properties
Pipe Pool ServiceWP PipePoolServicePipePoolService.properties
Portlet Container Service.
See also Enabling parallel portlet rendering
WP PortletContainerServicePortletContainerService.properties
Project Identification ServiceWP ProjectIdentificationServiceProjectIdentificationService.properties
Registry ServiceWP RegistryServiceRegistryService.properties
State Manager Service
See also URL normalization for search of portal pages by external search engines
WP StateManagerServiceStateManagerService.properties
Virtual Portal Configuration ServiceWP VirtualPortalConfigServiceVirtualPortalConfigService.properties
Table 2. WebSphere Portal security services
WebSphere Portal security serviceService name in the WebSphere Integrated Solutions ConsoleWebSphere Portal properties file
Authentication ServiceWP AuthenticationServiceAuthenticationService.properties
Credential Vault ServiceWP VaultServiceVaultService.properties
Portal Access Control Services  
    Access Control Data Management ServiceWP AccessControlDataManagementServiceAccessControlDataManagementService.properties
    External Access Control ServiceWP ExternalAccessControlServiceExternalAccessControlService.properties
    Auditing ServiceWP AuditServiceAuditService.properties
    Access Control ServiceWP AccessControlServiceAccessControlService.properties
    Access Control WarmUp ServiceWP AccessControlWarmUpServiceAccessControlWarmUpService.properties
    PAC Group Management ServiceWP PACGroupManagementServicePACGroupManagementService.properties
Puma Store and Validation Services  
    Puma Store ServiceWP PumaStoreServicePumaStoreService.properties
    Puma Validation ServiceWP ValidationServiceValidationService.properties
Table 3. Other WebSphere Portal configuration services
WebSphere Portal serviceService name in the WebSphere Integrated Solutions ConsoleWebSphere Portal properties file
Credential Type Registry ServiceWP CredentialTypeRegistryServiceCredentialTypeRegistryService.properties
Dynamic UI Manager Factory ServiceWP DynamicUIManagerFactoryServiceDynamicUIManagerFactoryService.properties
IdentificationWP IdentificationIdentification.properties
Plugin Manager ServiceWP PluginManagerServicePluginManagerService.properties
Portal Filter ServiceWP PortalFilterServicePortalFilterService.properties
PortletFilterServiceWP PortletFilterServicePortletFilterService.properties
Site Analyzer Log ServiceWP SiteAnalyzerLogServiceSiteAnalyzerLogService.properties
Virtual Portal Identification ServiceWP VirtualPortalIdentificationServiceVirtualPortalIdentificationService.properties
WSRP Web Service SecurityWP WSRPWebServiceSecurityWSRPWebServiceSecurity.properties
Web Content ServiceWP WebContentServiceWebContentService.properties
Work Manager ServiceWP WorkManagerServiceWorkManagerService.properties
Table 4. Web Content Manager services
Web Content Manager serviceService name in the WebSphere Integrated Solutions ConsoleProperties file
Configuration ServiceWCM_WCMConfigServiceWCMConfigService.properties
Messaging ServiceWCM_MessagingServiceMessagingService.properties
Prerendering SrviceWCM_PrerenderServicePrerenderService.properties
Search ServiceWCM_SearchServiceSearchService.properties

Friday, 17 July 2015

Handling portal caches across cluster websphere portal

Cache :- Portal has built in cache mechanism like dynamic cache , distributed map,distributedCacheObject . Where you can share objects which saves time by retrieving it from cache instead of database call. If client has four nodes under a cluster how does then cache will be shared across the nodes. This should be fundamental point any web-sphere administration should never forget.To avoid this portal has data replication system which helps in replicating the data between all nodes.

Data replication service (DRS) is an internal WebSphere Application Server component that replicates data. Transport for sending data or objects or events from one managed server to another.This take care of syncing data between two nodes.

  • Uses HAManager and DCS data stack frameworks to accomplish replication. 
  • Has the notion of replicas; however DynaCache only works with Entire Domain.
  • Total Number of replicas = Number of servers in the replication domain -1 
  • Responsible for serialization and de-serialization of messages. 
  • DRS Bootstrap will be expensive, if aggressive replication occurs during startup.
  • DynaCache, HTTPSession, Stateful Session Beans and SIP are major consumers. 
  • Data transfer channel can be encrypted. In practice no-one does this. 
  • DCS uses a star topology for synchrony resulting in scalability bottlenecks
WAS console :- Navigate to web-sphere application server console -> Resources -> object cache instances -> click on cache instance . Then select enable data replication then select replication type based on your requirement. Better suggested in Not_Shared if required use push or push_pull but don't go with pull option its very expensive.


In all of the following modes, the invalidation's will be sent across servers for data consistency. :-
 PUSH mode :- Both cacheId and CahceData will be sent to all servers in cluster
 PULL mode (Not recommended) :- Server requests the data from other servers in cluster, when not present in its cache
 PUSH PULL mode:- Only cacheId will be sent to all servers in cluster. When a server need an entry that is in PushPull table, it requests the server that has copy.
Not Shared :-In this mode the cache data will not be shared across servers. But the invalidation events are sent to all servers.

Source :- 
http://www-01.ibm.com/support/docview.wss?uid=swg27017355&aid=1




Tuesday, 7 July 2015

Using release builder in WebSphere portal

ReleaseBuilder :- This command line tool compares different XMLAccess exports taken over time, generating a difference XMLAccess file that can be used to move the changes made to the next environment.
The tool is used in staging to production scenarios.

Use-case :- A company infrastructure has staging and production environments lot of changes will be changed in staging server later they want to  move those changes to production server. in this case we can use ReleaseBuilder to pick the changes which were modified and migrate only those changes.


Step 1 :-
Open a command prompt and change to /opt/WebSphere/wp_profile/PortalServer/bin
Generate the release export by invoking following command -

./xmlaccess.sh -in /opt/WebSphere/Portal/doc/xmlsamples/
ExportRelease.xml -out ChangedRelease.xml -url
http://localhost:10039/wps/config -user wpsadmin -password wpsadmin

Step 2 :- 
Now we generate the difference between the release export we did before performing changes in staging server(ReleaseDiff.xml). To do this, execute the following command :-

./releasebuilder.sh -inOld InitialRelease.xml -inNew ChangedRelease.xml -out ReleaseDiff.xml

Step 3 :-
Now pull the differences files and run xmlaccess.sh to move changes to prod environment

./xmlaccess.sh -in outputfile.xml -user wpsadmin_user_ID -password wpsadmin_pwd -url "http://productionserver.example.com:port/wps/config"

Monday, 6 July 2015

WebSphere portal scripting interface

Portal Scripting Interface :-  Using this interface we can write scripts which can automate the process of configurations. Developers can create these scripts and provide it to deployment team , So that the dependency between two teams will be decreasing.

Two languages used for scripting :- We will have a look at Jython it will be easy to understand because its close to programming language
1) Jython (Object.method(arg1, arg2))
2) Jacl ($Object method arg1 arg2)

Jython :- Its a scripting language which is used on wsadmin tool to perform portal operations.Closely related to object oriented concepts and uses portal script beans to perform operations.

The available beans are:- 
Portal
Content
Layout
Portlet
Look
Access
PacList
Application
ArchivedApplication
ApplicationCategory
TemplateCategory
Publish

Sample script :-  UpdateLayout.py
# login to portal
Portal.login("wpsadmin","wpsadmin")
print " 1. login done."
# select page
Content.select(Content.find("all","uniquename","wp.test.page"))
print " 2. page selected"
# search portlet
portletA = Portlet.find("portlet", "name", "Struts Standard Stock Quote")
print " 3. portlet found: " + portletA
# create a vertical container
Layout.create("container", "vertical", "select")
print " 4. vertical container created."
# create a control with the portlet
Layout.create("control", portletA)
58
print " 5. create control with stock portlet."
# logout again
Portal.logout()
print " 6. logout."
print
print " Processing done."

where “#” denotes a comment, “print” prints a message to the command line

Sequence of the script is:-
Login
Locate the page
Create a container on the page to hold the portlet
Put the portlet into the container
Logout

Invoke the script to set the layout for the new test page:-
./wpscript.sh -user wpsadmin -password wpsadmin -lang jython -f
UpdateLayout.py

Saturday, 4 July 2015

Deploy portlet via XML access websphere portal

Overview :- Deploy a sample portlet with the XMLAccess input script shown in listing

Step 1 :-  Create DeployPortlet.xml as given below to deploy the portlet ear

<?xml version="1.0" encoding="UTF-8"?>
<request
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="PortalConfig_8.0.0.xsd"
type="update"
create-oids="true">
<portal action="locate">
<web-app action="update" active="true"
uid="SPFStandardStockQuote.war.webmod">
<url>file:///$server_root$/installableApps/NameOfWarFile.war</url>
<portlet-app action="update" active="true"
uid="NameOfWarFile.war">
<access-control externalized="false" owner="undefined"
private="false">
<role actionset="Privileged User" update="set">
<mapping subjectid="all authenticated portal users"
subjecttype="user_group" update="set"/>
</role>
</access-control>
</portlet-app>
</web-app>
</portal>
</request>

Step 2 :- Open command line, change to /opt/WebSphere/wp_profile/PortalServer/bin,
copy the war file to installableApps and DeployPortlet.xml xmlaccess file on to desktop, and
trigger following command
./xmlaccess.bat -in ~/Desktop/DeployPortlet.xml -out
DeployPortlet_out.xml -url http://localhost:10039/wps/config -user
wpsadmin -password wpsadmin

Step 3 :- Check the output file, DeployPortlet_out.xml in the
/opt/WebSphere/wp_profile/PortalServer/bin directory

Result :-
The portlet is now imported and can be verified from portal administration by adding it to a page.

Compressing files on IBM HTTP server


# compress everything but images
LoadModule deflate_module modules/mod_deflate.so
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio

# log some info
#LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
#CustomLog logs/deflate_log deflate

# Insert filter
SetOutputFilter DEFLATE

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|exe)$ no-gzip dont-vary

Heap dumps and java core files websphere portal

Memory issues :- Most of the applications have memory consumption issues. JVM unexpectedly shutdowns due to memory issues. To identify these type of issues we can check java core and heap dump values.

Java core :- When JVM gets stopped unexpectedly javacore files will be generated it contains the mutliple threads which got hung during multiprocessing.

Heap dump :- Heap dump contains thread information with memory information these files can be manually read or imported in tools available online to identify the memory leak.

Process to generate heap dumps :- Up and running websphere portal is represented by PID. If we kill this process heap dumps will be generated.

Unix/linux ;-
kill -3 <PID>

Windows :- 
In task manager kill java.exe file

Location of heap dumps :- Under this location /IBM/WebSphere/AppServer/profiles/wp_profile/ we can find heap dumps.

Note:- native_stderr.log, containing the JVM messages, including garbage collection data if verbose
garbage collection is enabled. It's possible to configure a separate file to contain the verbose
garbage collection data, which would have a custom name, for example, Verbosegc.

Custom single threaded java server

 package com.diffengine.csv; import java.io.*; import java.net.*; import java.util.Date; public class Server { public static void main(Str...