Pages

Saturday, July 23, 2011

Developing and Deploying OIM 11G Custom Scheduler Task

Hi

The following steps used to build the Custom Scheduler Task in OIM 11g

Environment Setup

The following jar files are required to compile the Custom Scheduler Task Java file. They are
1) wlfullclient.jar
2) wlclient.jar

Generating wlfullclient.jar
Go to the WL_Home/server/lib directory and Run the following command

java -jar wljarbuilder.jar

It will generate the wlfullclient.jar file and set the class path for the wlfullclient.jar and wlclient.jar file.


Develop the Java Class

package test.scheduler;

import java.util.HashMap;

import oracle.iam.scheduler.vo.TaskSupport;

public class TrustedSourceReconciliation extends TaskSupport {

public TrustedSourceReconciliation() {


System.out.println("TrustedSourceReconciliation() Called");
}

/**
* This method called by quartz scheduler and HashMap contains the config parameters.
*/
public void execute(HashMap arg0) throws Exception {

System.out.println("SfsuTrustedSourceReconciliation Arguments "+arg0);
}

public HashMap getAttributes()
{
return null;
}
public void setAttributes()
{

}

}

Make Jar File

Jar cvf TrustedSourceReconciliation.jar *


Develop the Custom Scheduler Config File


<scheduledtasks xmlns="http://xmlns.oracle.com/oim/scheduler">
<task>
<name>TrustedSourceReconciliation</name>
<class>test.scheduler.TrustedSourceReconciliation</class>
<description>Trusted Reconciliation</description>
<retry>5</retry>
<parameters>
<string-param required="true" encrypted="false" helpText="User Name">DB User Name</string-param>
<string-param required="true" encrypted="false" helpText="DB Password">DB Password</string-param>
<string-param required="true" encrypted="false" helpText="DB URL">DB URL</string-param>
<string-param required="true" encrypted="false" helpText="Select Statement">Select Statement</string-param>
</parameters>
</task>
</scheduledTasks>

Save this file as TrustedSourceReconciliation.xml because Custom Scheduler task name and file name as same as per the oracle custom scheduler scpecification.

XML Name space is very important when you deploying custom scheduler task in MDS Schema. If you give wrong name space in scheduledTasks tag and it will deploy in the OIM MDS Schema But OIM won't recognised as a ScheuledTask.


Develop the plugin.xml file

<?xml version="1.0" encoding="UTF-8"?>
<oimplugins>
<plugins pluginpoint="oracle.iam.scheduler.vo.TaskSupport">
<plugin pluginclass="test.scheduler.TrustedSourceReconciliation" version="1.0" name="TrustedSourceReconciliation"/>
</plugins>
</oimplugins>


Making the Scheduler.zip File

plugin.xml file
lib/TrustedSourceReconciliation.jar

Regsiter the Plugin File into the OIM Server

ant -f pluginregistration.xml register

It will ask the following details after running the above command


1) OIM Admin User Name : xelsysadm
2) OIM Admin Password : xelsysadm password
3) OIM URL : t3://localhost:14000
4) Plugin Zip File absolute path.

It will deploy the OIM Plugin without any issue. Some Times It will throw error if the class file is not found in the jar file.

Importing the Custom Scheduler Task into MDS Schema

Go to the OIM_HOME/bin directory and modify the following properties in the weblogic.properties file

wls_servername=oim_server1
application_name=oim
metadata_from_loc=/home/oracle/schedulers

Schedeler Config file location as /home/oracle/schedulers/db/TrustedSourceReconciliation.xml

Run the weblogicImportmetada.sh file and will ask the following details


1) Weblogic Admin User Name : weblogic
2) Weblogic Admin Password : weblogic admin password
3) weblogic Admin URL : t3://localhost:7001

After running the above command the custom scheduler task will be imported into the MDS Schema.

Clear the OIM Cache

Run the PurgeCache.sh All file and it will ask the following details.


1) OIM Admin User Name : xelsysadm
2) OIM Admin Password : xelsysadm password
3) OIM URL : t3://localhost:14000


After running the above command and it will clear the OIM cache

Restart the OIM Server

Go to the WL_DOMAIN_HOME/bin direcory and run stopManagedServer.sh oim_server1 command and it will stop the oim managed server.

Run the startManagedServer.sh oim_server1 and it will start the OIM Managed Server.

Testing The Scheduler Task

Login to the OIM Admin Console >> Advanced >> System Management >> Scheduler >>Create >> Search the TrustedSourceReconciliation and select the Scheduler and enter the parameters and click Save and run the Scheduler.


Trouble Shooting

Problem : Scheduler Task is not showing in the Scheduler List
Cause : Scheduler Name space is missing
Solution : Check the Scheduler name space in the scheduer task. The name space always xmlns="http://xmlns.oracle.com/oim/scheduler"

Problem : The Scheduler implemented class file not found while deploying the plugin.zip file.
Cause : The class file is missing in the zip file.

Solution : Please add the jar file into the lib directory and make the zip file again and regsiter the plugin.


Reference Document : Oracle Identity Manager Developer Guide

28 comments:

  1. Hi Guru,

    I Really Happy to say thanks for Your Efforts/Post,
    because it's very helpful to me.

    Actually am very new to OIM, am going to work on it,but i don't have that much of idea regarding the same.can you please provide the some more Documents.

    My requirement is create the user and organization,assign the roles to the user,and forms creation etc..

    Kindly provide the Steps for my requirement.


    Thanks in Advance

    Regards
    Raju Swargam
    Raju.swargam@cloverinfotech.com
    swargamraju@gmail.com

    ReplyDelete
  2. Hi,
    I would like to thank pel initiative.
    I followed all the steps but the task does not appear in OIM console administration.
    Could you help me?

    Thanks a lot.

    ReplyDelete
    Replies
    1. Hi

      Please login into the OIM Admin Console and Click Advance >> System Management>> Scheduler >>action>>create>>task. search for the task and it will be available in the task list. Please check the scheduler name space in the scheduler.xml file. Please let me know if you need further assistance.

      Delete
    2. Hi, Thanks for posting excellenet blog. I have problem in registering the plugin, when I run the ant -f pluginregistration.xml register
      getting below error.
      'error in registering the plugin : java.io.EOFException'. Please let me know what the issue could be.

      Delete
    3. Hi.

      Please check your plugin zip file size. If the file size exceeds more than 1 MB and it throws exception. If your using third party jars, please upload the jar files into the OIM data base or copy the OIM_HOME/ThirdParty Directory. Please let me know if you have any issues.

      Delete
  3. Relay nice post.. I have done the same as you do. I think there is tag () missing in TrustedSourceReconciliation.xml as a result I am gating a error message like this

    : XML-20121: (Fatal Error) End tag does not match start tag 'scheduledtasks'.
    MDS-91009: Operation "importMetadata" failure. Use dumpStack() to view the full stacktrace.

    Finally it is resolve. Thanks again for this nice article

    ReplyDelete
  4. Hi Tamim.

    Thank you for you to sharing your experience.

    ReplyDelete
  5. what is the JAR file for the oracle.iam.scheduler.vo.TaskSuppor?? and also where can i find all other API jar files for OIM?

    ReplyDelete
    Replies
    1. The Tasksupport class file is available in the Oracle_IDM1/server/client/oimclient.jar. Please let me know if you have any issues.

      Delete
  6. Hi,

    I have a requirement like "create a java code to maually complete rejected or pending tasks"

    can you help me in doing java code.

    ReplyDelete
    Replies
    1. Thanks for you to watching the blog. I will post the code in blog tomorrow. Please check the blog and let me know if you have any issues.

      Delete
    2. Hi
      I have posted the example code in the blog. The blog url http://idmoim.blogspot.com/2013/12/tcprovisioningoperationsintf-api.html. Please let me know if you have any issues.

      Delete
  7. Hi,

    Thanks a lot .
    Will get back to you soon.

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. This comment has been removed by the author.

    ReplyDelete
  10. Hi Harish,

    I can't understand your requirement. Please can you explain more detail and I can help you.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  11. This comment has been removed by the author.

    ReplyDelete
  12. please check enabling the logging in OIM:

    http://idmoim.blogspot.com/2011/07/enabling-logging-in-oim-11g.html

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Hi
    Sorry for the delay response.
    Currently I need to complete my deliverable. Please try above example and modify according to your requirement with simple configuration. In my example I am passing the database detail to establish the connectivity. For example you need to retrieve the User Name parameter and display in the log file.

    String dbUserName= (String)arg0.get("User Name");

    Logger logger=Logger.getLogger("Logger-Name");

    logger.Debug("Displaying User Name :"+dbUserName);

    It will print the dbUserName in the log file.

    In my earlier comments, I have provided the logging configuration for OIM.

    Please try and let me know if you need any help.

    ReplyDelete
  16. Hi ,

    Please post the complete Java code for retying provisional task

    ReplyDelete
    Replies
    1. hi

      http://idmoim.blogspot.com/2013/12/tcprovisioningoperationsintf-api.html

      Delete
  17. Hi ,

    Article is excellent.

    I tried creating a custom scheduler (pick from csv file and create user in oim ). Scheduler works ,if i click "RUN NOW".

    But i need scheduler to run every 5 mins itself . I have set to Periodic ,still not working.

    Kindly help

    ReplyDelete
  18. Very Nice Blog for Scheduler Task ... Excellent work.

    ReplyDelete