Skip to Content
author's profile photo Former Member
Former Member

creating KM Service

Hi all,

I'm trying to implement an own KM service in EP6 SP2.

It should repeatedly (about every 10 minutes) search for documents of some property in KM repository defined and then copy them into specified location/folder.

Now the service works fine, but some problems occurs when the EP is starting (<b>after EP restart the service hangs the portal</b>).

now I'll try to show some code:


public class MyService implements IMyService, Runnable {




try {

IResourceFactory m_Factory = ResourceFactory.getInstance();

if (m_Factory != null) {

IResourceContext context = m_Factory.getServiceContext("our_service_user");

if (context != null) {

RID aRid = RID.getRID(rootDir);

ICollection aCollection =(ICollection) m_Factory.getResource(aRid, context);




} catch (ResourceException e) {



When I deploy the service to the running portal it works fine. But when the portal is starting the service hangs at this line:

<i>IResourceContext context = m_Factory.getServiceContext("our_service_user");</i>

Maybe the KM is not initialized till now (it initializes when the user first uses a KM iview (, ...)).

Does anybody know how to initialize the KM from the API?

Any hints?


Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jun 23, 2004 at 03:49 PM

    Hi Romano,

    I'm trying to do something similar - how have you managed to get the service to run every 10 minutes? Did you use the Scheduler service or are you using a timer?

    Good luck,


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member


      I'm not sure I understand.

      In my service the init method looks like this:

      <i> public void init(IServiceContext context) {

      t = new Thread(this);




      I just start a new thread (don't ask why, but when I deploy this the "destroy" method kills the previous thread - I think 😉 - so no more than 1 instance of my service runs at one time (maybe it is not neccesary):

      <i> public void destroy() {


      t = null;


      All the process comes in the method "run".

      Now I'm thinking about creating another service, which will periodically try to connect to portal to "raise" the KM and give the information about the success to my second - KM service.

      So any hints will be usefull.