Skip to content
May 26, 2012 / Mário Maçarico

Oracle UCM 11g – Analyzing and Debugging

Environment

For development and UCM testing I use a virtual machine with a DB, Weblogic Server and UCM 11g installed. I also have a VM image backup of this environment. This allows me to do try just about anything without fear of ruining UCM as I can always go back to that image. I will use this environment in all my future posts. Now let’s get started.

Get yourself some documentation

These documents will help in getting to know how UCM works. It will also help when you need to add new features or customizing existing features in UCM.

Important UCM files. Where should I be looking at?

These files define the services, queries, outputs and idoc scripts used by UCM.

  • UCM core IdcServices are defined in the file <ORACLE MIDDLEWARE>/<ORACLE EMC>/ucm/idc/resources/core/tables/std_services.htm
  • UCM core queries are in the file <ORACLE MIDDLEWARE>/<ORACLE EMC>/ucm/idc/ resources/core/tables/query.htm
  • UCM core templates definition file <ORACLE MIDDLEWARE>/<ORACLE EMC>/ucm/idc/ resources/core/templates/templates.hda
  • UCM core idocScript resources are in the folder file <ORACLE MIDDLEWARE>/<ORACLE EMC>/ucm/idc/ resources/core/idoc, the most common in the std_page.idoc
You will be looking a lot to this files if you happen to need to modify UCM default behaviours.

Which idoc script does what? Where can I find it?

  1. Start by going to the IdcService definition (std_services.htm) and find the template name of the respective IdcService.
  2. Go to the templates.hda file and search for the template name.
  3. The fourth line in the template definition is the file associated with the template. This will be the file that will execute as the result of the IdcService.
Example std_services.htm (Doc Info):

(..)<tr>

<td>DOC_INFO</td>

<td>DocService

33

DOC_INFO

null

null<br>

!csUnableToGetRevInfo</td> (..)

 Example templates.hda (Doc Info):

(…)DOC_INFO

Document

DocumentInfoPage

doc_info.htm

Document Information Form(..)

Finding the exact idoc script is the hard part. I have yet to find a good method. If you know one please let me know. What I do is sort of trial and error. I view the html source page (use a browser debug tool to help) and try to identify some common or unique string (a specific input name, css class name, or piece of html code) and then do a text search on the <ORACLE MIDDLEWARE>/<ORACLE EMC>/ucm/idc/resources folder. I use Total Commander for that.

You can override or add custom idocScript to existing idocScript but I will leave this for a future post that will focus on customizing UCM.

What is UCM doing and how?

If you need to know what UCM service is being executed one trick is to view what IdcService is being called. In my opinion the best way to view this is to use a browser debugging tool and analyze the request. I use firefox and the firebug extension.

Example:

What IdcService is used to get a document information and it’s detail page?

Do the action (in this case, show the document detail) and analyse the sent request. The idcService used in the document detail is DOC_INFO.

Now that you know what idcService is being call take a look at its definition (std_services.htm)

Name Attributes Actions
DOC_INFO DocService 33 DOC_INFO null null
!csUnableToGetRevInfo
5:QdocInfo:DOC_INFO:2:!csItemNoLongerInSystem2(dDocName,dID) 3:mapNamedResultSetValues:DOC_INFO,dStatus,dStatus,dDocName,dDocName,dDocTitle,dDocTitle:0:null 3:checkSecurity:DOC_INFO:0:!csUnableToGetRevInfo2(dDocName) 3:getDocFormats:QdocFormats:0:null 3:getURLAbsolute::0:null 3:getUserMailAddress:dDocAuthor,AuthorAddress:0:null 3:getUserMailAddress:dCheckoutUser,CheckoutUserAddress:0:null 3:getWorkflowInfo:WF_INFO:0:null 3:getDocSubscriptionInfo:QisSubscribed:0:null 5:QrevHistory:REVISION_HISTORY:0:!csUnableToGetRevHistory(dDocName) 3:loadAdditionalDocInfo::0:null 3:loadProfileForRequest:Info:0:!csUnableToGetRevInfo2(dDocName)

Let’s take the DOC_INFO service as an example.

This ‘DocService’ on the attributes specify which service class the service has access to. Meaning that all actions market as ‘3’ (meaning java method action) must be accessible to that service class.

The ‘DOC_INFO’ on the attributes field is not to be confused by service name. This is actually the TEMPLATE name that the service will use to render the page output.

Check page 43 of document  http://docs.oracle.com/cd/E21764_01/doc.1111/e11011.pdf for more information about what field does and means.

Tip: Do you want to know what idoc script variables are being defined and used by a specific UCM service? Do an url call to that idcService with the additional parameter “IsJson=1”. The response will be a json text containing all idoc variables and ResultSets.

This is a very basic example but it can be used when you need to identify some service that needs customization. If you need more information about the inputs and outputs of a service use the documentation ‘Services Reference Guide for Oracle Universal Content Management 11g’ – http://docs.oracle.com/cd/E21764_01/doc.1111/e11011.pdf

Java debugging

So, you have your component with custom java code and you need to debug it.

Remote debugging your code can help a lot. What you need to do to make it work?

      • Access your environment and go to <ORACLE MIDDLEWARE>/user_projects/<UCM_DOMAIN>/bin
      • Make a copy of the startWeblogic.sh file and name it startWeblogicNoDebug.sh
      • Edit your startWeblogic.sh
        • Add the following line before the line ${JAVA_HOME}/bin/java ${JAVA_VM} -version
          • JAVA_OPTIONS=”${JAVA_OPTIONS} -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n”
      • If you are like me, your weblogic server and UCM are running on the same machine, so to start weblogic you should use the startWeblogicNoDebug.sh command. If you start Weblogic using the new .sh document it will use the port for debugging and UCM will fail  because the port will already be in use.
      • Start UCM. In the output the following line should appear: ‘Listening for transport dt_socket at address: 8000’
      • Eclipse
        • Start you eclipse
        • Go to ‘Debug Configurations….’
        • Create a new Remove Java Application with:
          • Connection Type – Standart (Socket Attach)
          • Host – The IP ou hostname where your UCM machine is.
          • Port – 8000  (you can change the port of course, don’t forget to change the startWeblogic.sh accordingly)
      • Start your debug and insert a breakpoint on your code
      • Happy debugging

Future Posts

This first post was meant as an introduction to the future posts I will do. My next writings will be focusing on UCM customizations., namely:

  • Creating custom components
  • Creating and modifying UCM services
  • Modifying existing templates / idoc script
  • Developing custom Schema Security Filters

Signing out for now

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: