Monday, May 30, 2011

Changing Portlet Persistent Store from File to Database in Oracle Webcenter

Hi,

Last week i got a recommendation from Oracle support on some issues in our environment to change portlet persistent store from file to database. By default portlets store their state in file at OS level it is recommended for high availability and specially in a cluster environment to use database as a persistence store.

You can verify the portlets current persistent on INFO page of portlet which has a the following URL syntax

http://server-name:port/portlet-name/info

As you can see in following screen shot the persistent store is set to File.


Changing Persistent store

It is a 3 step process
  1. Change setting in web.xml file 
  2. Run Persistence migration utility
  3. Change meta-data-storage settings in adf-config.xml
Step 1:
Add a environment entry in web.xml to tell portlet to use database as persistent store




Step 2:

Run Persistence migration utility as oracle os user make sure you set the JAVA_HOME variable to correct Java home.

echo $JAVA_HOME
 
$java  -classpath /u01/Oracle/Middleware/Oracle_WC1/webcenter/modules/oracle.portlet.server_11.1.1/oracle-portlet-api.jar:/u01/Oracle/Middleware/Oracle_WC1/webcenter/modules/oracle.portlet.server_11.1.1/wsrp-container.jar:/u01/Oracle/Middleware/wlserver_10.3/server/lib/ojdbc6.jar oracle.portlet.server.containerimpl.PersistenceMigrationTool -sourceType file -destType db -sourcePath /u01/Oracle/Middleware/Oracle_WC1/portal/portletdata -destUsername dev_portlet -destPassword myPassword -destDatabase mydatabase:1521:mySID -debug
 

Step 3:
Change metadata-store to database jndi as shown in the screen shot


Test the new changes by going to the Portlet info page



Verify the portlet appearance in MDS repository in EM FMW


Register the Portlet again, delete the portlet from webcenter page and add again



Have a nice day,
Zeeshan Baig

5 comments:

  1. Humm... Looks familiar as well. :)

    ReplyDelete
  2. Hi Zeeshan,
    I am using a MS SQL 2005 database. The connection string in your post does not work with SQL Server. Do you know what syntax to use?

    ReplyDelete
  3. I was able to figure it out for SQL Server. Here it is for future reference:

    -destDatabase "jdbc:sqlserver://mydatabaseServerName:1433;databaseName=myDatabaseName"

    Note, you need to include the classpath for the sql jdbc driver as well as set the destination driver like this:
    -destDriver com.microsoft.sqlserver.jdbc.SQLServerDriver, just before the -destDatabase parameter.

    ReplyDelete