Showing posts with label Webcenter. Show all posts
Showing posts with label Webcenter. Show all posts

Saturday, November 29, 2014

Cluster configuration for High availability ADF applications

Need of clustered environment

If your system is underperforming and not available enough then that signs that you need clustering. It will improve Scalability and high availability (If one member of the cluster is unavailable, any other available member of the cluster is able to handle the request.)
When the Fusion web application runs in a clustered environment, a portion of the application’s state is serialized and copied to another server or a data store at the end of each request so that the state is available to other servers in the cluster .If it not serialized then user will lose data upon fail-over.
WebLogic duplicates those sessions by serializing the objects in the session and then transfers it to the secondary machine. Only the objects that are stored in the session will be replicated. From an ADF perspective this means that managed bean with pageFlowScope and above will be replicated.

Configuring Oracle ADF development for High Availability

JSF Component Binding
  1. Always use ComponentReference binding code in your managed beans, regardless of the scope  the bean is in.
  2. Never use UIComponent binding in session-scoped managed beans.
  3. Please make sure that managed beans used in ADF application with a scope greater than one request should be serializable (implement the java.io.Serializable interface).

Specifically, beans stored in session scope, page flow scope, and view scope need to be serializable.
UIComponent is not a serializable class, and you are going to get a serialization exception in case of binding components to the long-living managed beans.
Also the UI component tree might not be released correctly, significantly increasing the memory load of your application.

Solution: (for Binding UI Component)
The standard UIComponent binding code looks like this:

RichInputText nameField;
 public void setNameField(RichInputText nameField)
{
  this.nameField = nameField;
}
 public RichInputText getNameField()
{
  return nameField;
}

Should be replaced with code like this:

private ComponentReference nameField;
public RichInputText getNameField()
{
  if (nameField!=null)
  {
    return (RichInputText) nameField.getComponent();
  }
  return null;
}

public void setNameField(RichInputText nameField)
{
  this.nameField = ComponentReference.newUIComponentReference(nameField);
}

Configuring Application Modules

Right-click the application module and select Configurations. Click Edit. Click the Pooling and Scalability tab. Select the Failover Transaction State Upon Managed Release checkbox.

<AppModuleConfig ...
 <AM-Pooling jbo.dofailover="true"/>
</AppModuleConfig>

Configuring weblogic.xml

In weblogic.xml file, add entry as below persistent-store-type definition to the session-descriptor element like below


<weblogic-web-app>
    <session-descriptor>
    <persistent-store-type>REPLICATED_IF_CLUSTERED</persistent-store-type>
    </session-descriptor>
</weblogic-web-app>

Configuring adf-config.xml

In adf-config.xml file, add entry as like below
<adf-controller-config xmlns="http://xmlns.oracle.com/adf/controller/config">
 <adf-scope-ha-support>true</adf-scope-ha-support>
</adf-controller-config>

Notify ADF for Bean new value

When a value within a managed bean in either view scope or page flow scope is modified, the application needs to notify Oracle ADF so that it can ensure the bean's new value is replicate.

Map<String, Object> viewScope =
    AdfFacesContext.getCurrentInstance().getViewScope();
MyObject obj = (MyObject)viewScope.get("myObjectName");
Obj.setName("newValue");
Use the markScopeDirty() method,
controllerContext ctx = ControllerContext.getInstance();
ctx.markScopeDirty(viewScope);

There is one more option which needs to be tested:
You can also enable automatic tracking of scope modifications. To do this you should modify adf-config.xml as shown below,


Check default logger messages

Run each use case in UI application. Verify that you don’t see below highlighted errors in Domain console log.

[manageserver1] [ERROR] [] [oracle.adfinternal.controller.state.SessionBasedScopeMap] 
java.io.NotSerializableException: com.ram.mytest.manage.TestMB

Changes in Application server

While doing development Jdeveloper integrated server will not throw any errors by default. Add this parameter in server (setDomainEnv.cmd) has to be run with the following JVM parameter:

-Dorg.apache.myfaces.trinidad.CHECK_STATE_SERIALIZATION=all

For more detail about sample application deployment in cluster and configurations, check out my post here

Thursday, April 12, 2012

Globalization in webcenter

Globalization feature in the Webcenter is good and find the below video to get more idea.
Here we can easily change the labels in the different language. But not the content in the pages. It depends on where the content comes from, If it comes from UCM or some other content server you need to translate the content in the content server as well or pass the language to the content query.

Note : The portal framework will behave generic and it will change all the text and labels in the Admin console according to the language set.




use this snippet in the custom phase listener or in the value change listener of the Template bean.

String language = Locale.getDefault().getLanguage();
Locale newLocale = new Locale(this.language);
FacesContext context = FacesContext.getCurrentInstance();
context.getViewRoot().setLocale(newLocale);

short summary :

1. Use resource bundles for everything
2. for the navigation model, in the title you can't use expression language BUT you can use expression when creating the template of your site so instead of adding a real title in the nav model, specify a key matching the value in the bundle. This way you can use EL in your template that renders the navigation
3. When you create custom taskflows, use resource bundles.
4. when you want to change labels in existing webcenter taskflows, customize the resource bundle.




Thursday, January 12, 2012

Custom Skinning in the Webcenter 11g and Image rendering issue..!

Hi All,

I want to share some information about custom skinning in the Webcenter application. This is quite similar to the normal skinning in the ADF application, but we need to configure some points to use custom skinning.

Whenever creating the webcenter portal application you have an option to create all the configuration files using the wizard. That creates all the necessary files in the application including the file portal-skin.css inside oracle/webcenter/portalapp/skins/portal-skin.css.

Generally you can add the styles for the components with the alignment, colors and so on, if you add the images

Steps to do ,

Before start writing your styles in the css file change css level to 3 in the the JDEV preference, this helps you auto suggesting the skin selector classes in the css file while writing.
Tools->Preferences->



1. Add the custom skin selectors in this in the new css file or portal-skin.css file. For example,

af|inputText::content{
color: Blue
}

af|panelBox::header-center:core:default{
background-image: url('/images/cssimages/panelreg.PNG');//background-image: url('../../cssimages/images/panelreg.PNG');
height: 41px;
width: 290px;
}
similar way you can add all the styles for the components for those you need. For more skin selectors http://jdevadf.oracle.com/adf-richclient-demo/faces/components/skinningKeys/panelBox.jspx

Note here have highlighted and commented a line, Usually the when referring the an image inside the style classes in the css file it will allow you to choose the image . If you choose like that the path will be like "url('../../cssimages/images/panelreg.PNG'); ". If you refer like this 'Image will not render in the page' .



This is because if you see the image in the browser using firebug inspect element, the image url will be like this -context-root/mds:/oracle/webcenter/portalapp/shared/faq.PNG.
Here mds: is referring the images. I don't have much idea about why this is coming. It might be the image should be added in the mds I think. Then I used the path like this in the css url('/images/cssimages/panelreg.PNG'); without using the/.../.../. Then its working.



2. Register the skin in the portal by Right click on the css file -> create portal resource



3. Set the default skin family in the adf-config.xml.
Application resources ->Descriptors-> ADF META-INF->adf-config.xml

then go to source and change the skin family name in the value feild.



Note: If you are adding the styles in the portal-skin.css file leave the default value(portal).



4. Set the DISABLE_CONTENT_COMPRESSION value in the web.xml to true. by default it is false. Change is true.

org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION
true

5. Run and test Application page,






For more details about skinning http://docs.oracle.com/cd/E21764_01/webcenter.1111/e10148/jpsdg_skin.htm