Skip to Content
Introduction

Last year I wrote a scheduler for running jobs in portal. A month later I found out that KM already provides a very good api for scheduling jobs which can run periodically. You can write any kind of job that can be executed via JAVA.Please don’t think the job only runs for KM stuff. I am currently using this scheduler task to extract BW data in xml format and store it in KM. So, in this weblog i am going to present a help guide for creating KM’s scheduler task for running jobs periodically.

The following steps will guide you in creating KM’s scheduler task for Portal

Step 1:

Create an empty project
image

Step 2:

Using the KM Scheduler Task Wizard, create a empty template for your job.
image
Click on Next
image
Fill out the above screen and click on Finish.

Step 3

Navigate in your project structure (under src.api folder) to find you java class file extract.java or whatever you have defined the class name in the wizard. You will find the following template already created by NWDS.

Step 4

Modify the code to do whatever task you want the class to perform. In my case i am going to grab a yahoo’s world news rss feed and store it in KM.

Step 5:

Build your component and deploy your par and then navigate to following location.
System Administration->System Configuration->Knowledge Management->Configuration->Content Management->Global Services->Scheduler Tasks

Step 6:

You will see your task. Click on it and schedule it to run at a particular time. You can define new periodic times as well.
image

Click your task(in my case it is com.ust.yahooxmlfeed.extract) and then click on edit
image

Select the time you want to schedule and then click on Apply and OK. In my case i am runing it 50 minutes past every hour

BAM! you got yourself a job that runs periodically

image -> image

To report this post you need to login first.

37 Comments

You must be Logged on to comment or reply to a post.

      1. Baggett Soran
        Hi Prakash, I am new to this forum, and I don’t even know how to post a question or suggestion on this forum, can you guide me?

        Thanks so much,
        Baggett

        (0) 
        1. Prakash Singh Post author
          Hi Baggett,
              if you have questions regarding my weblog then go ahead and post a reply. I will respond to your question. If you have a particular question which has nothing to do with my weblog then post in Forums under a specific category where question is best suited.
               thanks
          (0) 
          1. Baggett Soran
            Hi Prakash, I have some questions regarding converting Java Portlets into iViews, I was wondering if I can ask you?

            Thanks again,
            Baggett.

            (0) 
  1. Roy Cohen
    During the migration process problems have been reported for this blog. The blog content may look corrupt due to not supported HTML code on this platform. Please adjust the blog content manually before moving it to an official community.
    (0) 
  2. Simon Kemp
    Many people have followed your blog to create custom Scheduler tasks, but as usual people make mistakes and name things wrongly etc…. we need help to remove these tasks completely (see forum discussion /thread/57900 [original link is broken]). Can you help?

    Also, do you know of any reason why a scheduler task would cause the scheduler service to fail on startup?

    BRgds,
    Simon

    (0) 
  3. Fahad Saadah
    Hi Prakash,

    Thanks for your weblog. I followed your steps to the letter and managed to turn my component into a portal scheduler task. However, I have a big problem. Every time I deploy the component, the dev portal gets slower and eventually it dies.

    I noticed that deploying the scheduler task component is very slow. It takes minutes as opposed to a second with other components that do not implement IService. Also, every deployment of scheduler task component is slower than the one before it (until the server stops responding.)

    We had a look at the log file and noticed that the CM services is shut down and restarted every time I deploy.

    I think this is similar to what Simon Kemp mentioned in his reply (https://weblogs.sdn.sap.com/cs/user/view/cs_msg/5634)

    Any idea?

    Regards,

    Fahad

    (0) 
      1. Mk Bee
        Hi All,

        Can anyone help me in Scheduling the task. I have exactly followed the steps mentioned in the Prakash Blog. I don’t see my task in the logs as I don’t think it is running. Can any one give some clue on this.

        I have the same problem posed by the members. I don’t see reply in the blog, for the following problem: Scheduled ok but it is not running…

        Thanks,
        Mallik

        Scheduled ok but it is not running…
        2007-01-05 13:08:22 Luis Barragán Business Card [Reply]

        Hi Adrian, i have the same problem, how did you solve this one?
        Scheduled ok but it is not running…
        2007-05-28 08:06:27 Iryna Yantovska Business Card [Reply]

        Hi Luis,

        I have the same problem, how did you solve it?

        Kind regards
        Irene

        (0) 
    1. Anonymous
      Hi, I deployed the par in server and scheduled to run. But I recd error message as “Failed to start”. The error I recd is

      Caused by: com.sapportals.portal.prt.runtime.PortalRuntimeException: [PortalApplicationItem._prepare]: kms
              at com.sapportals.portal.prt.core.broker.PortalApplicationItem.prepare(PortalApplicationItem.java:427)
              at com.sapportals.portal.prt.core.broker.PortalApplicationItem._refresh(PortalApplicationItem.java:507)
              at com.sapportals.portal.prt.core.broker.PortalApplicationItem.refresh(PortalApplicationItem.java:457)
              … 56 more
      Caused by: com.sapportals.portal.prt.runtime.PortalRuntimeException: Exception during start of application: SAPJ2EE::library:
      ted.com/JavaWrap
              at com.sapportals.portal.prt.core.broker.SAPJ2EEApplicationItem.prepare(SAPJ2EEApplicationItem.java:323)
              at com.sapportals.portal.prt.core.broker.PortalApplicationItem.prepare(PortalApplicationItem.java:387)
              … 58 more
      Caused by: com.sapportals.portal.prt.core.broker.SAPJ2EELibraryNotFoundException: Could not find Library SAPJ2EE::library:ted
      .com/JavaWrap
              at com.sapportals.portal.prt.core.broker.SAPJ2EEApplicationItem.prepare(SAPJ2EEApplicationItem.java:277)
              … 59 more

      Please help me in resolving the issue

      (0) 
  4. Patricio Mansilla-Caro
    Hi,

    I’ve been following the steps mentioned in the Weblog, but I can´t get the task shown when I go to “Sustem Admin. > System Config. > KM > Content Management > Configuration > Global Services > Scheduler Tasks”

    What I’ve done is this:
    – Create an empty Portal Application project
    – Add a New Repository Framework  7.1.5 component (Scheduler Task) using the wizard
    – Put some code into the main Class
    – deploy using NWDS into portal

    Please, if you can give me any idea, it will be great.

    Kind Regards

    Patricio

    (0) 
  5. Tridib Chowdhury
    Hi Prakash,

    Great blog and very informative. Can I use this to schedule a custom portal service. Do you know which method/interface of the IService will give me a handle of the custom Portal Service start/stop attribute?

    Regards,
    Tridib

    (0) 
  6. Paul Adams
    Hi Prakash,

    This weblog helped us in scheduling an application. But we also have a problem here. When we deploy a second scheduler task, we can no longer see the first one in the topics list.
    The second one is replacing the first one. Any idea on why this is happening, are we missing something.

    Best Regards,
    Paul

    (0) 
    1. Cristian Fusi
      Hi,

      I know this post is a little bit old, but maybe this reply should be useful to other visitors..

      I have had the same problem, due to the fact that KEY property in IRFServiceWrapper interface was the same for both scheduler tasks.

      I think that it’s due to the wizard, when create an empty task initialize IRFServiceWrapper.KEY property.
      So you have to change it and make it unique in all scheduler tasks you create

      Hope this is helpful
      cheers
      Cristian

      (0) 
  7. Vicky De Waal
    When working with the NDWI, what type of developement component do I need to create.  I created a portal DC and used the wizard to create the scheduler task.  However, it does not appear in the global services> scheduled tasks.  I need some help
    (0) 
  8. Jay Kapadia
    Hi Prakash,
    I dont see the wizard Repository framework 7.1.5 in my NWDS. The version of my nwds is 7.0.10

    Can you tell me if its the right version

    (0) 
  9. Ivan Santillan
    Hi Prakash,

    It’s a really good weblog, I have one question, after I follow all the steps required for the deployment I can see the task in the path to the schedule it. But when I put an hour to test it (every 5 minutes) it doesn’t work, I hope you can help me with this problem, if you want it I can send you the code to see if there’s a problem with it.

    Thanks in advance.

    Ricardo

    (0) 
  10. Art Tech
    Very Nice to see ur blog it is very helpful for us.but in this you taken the external content to display in the portal which is like as a static one.

       I need the content should be in Dynamic like News Letter named as date.How to get the thing like that?

    Regards,
    Mythili

    (0) 
  11. Shilpa Bhanot
    Hi Prakash ,
    Great Blog!!!
    I want to know how can I schedule my portal application to continously update the SQL DB. I want to update the DB whenver theres an updation in UME.
    (0) 
  12. Pieter Herroelen
    Hi,

    How can you pass on some properties to the scheduler task?  

    I’ve noticed it in the arguments of the run method, but where can you set it?

    public void run( String id, Properties properties )

    (0) 
  13. Alessandro Tocco
    Hi, I follow your instructions and just after the PAR file deploy I get a “System Error Message” when I try to access to Portal Km.

    After a server restart everything works fine, but why does it happend?

    (0) 
    1. Adam Kreuschner
      Hi,

      when you deploy a par-file containing an configuration archive, like in the example here, the CM is shut down due to hot-deployment. In some cases and depending on the system configuration, this may cause the CM to become broken. In such a case a restart of the server is required in order to make CM work fine again.

      Regads,
      Adam

      (0) 
  14. Apurva Maduskar

    Hi,

    Nice blog.

    However, I am facing one strange issue with KM Scheduler Task.

    I have created development component for KM schedular task and completed configuration in System Administration -> System Configuration -> Knowledge Management -> Content Management -> Global Services -> Scheduler Task.

    Scheduler Task was working fine.

    Now I need to do some changes in task. I updated DC, build and deployed it and run schedular task by changing timing to current time.

    I observed that my changes are not getting reflect. Still old code is getting executed.

    What could be the issue? Do I have to clear some cache?

    Regards,

    Apurva

    (0) 
    1. Roy Cohen

      Hi Apurva

      KM doesn’t support hot deployment so you would need to restart the portal in order for your changes to take effect.

      Roy

      (0) 
      1. Apurva Maduskar

        Hi Roy,

        Thank you.

        Is there any workaround solution?

        During development cycle,  developer needs to make frequent changes based on changes in requirement. Sometimes developer has to follow trial and error approach for achiving required result. Restarting server multiple times is not always feasible.

        What can be done in this case?

        Regards,

        Apurva

        (0) 

Leave a Reply