cancel
Showing results for 
Search instead for 
Did you mean: 

7.3 Schedulertask shows NoClassDefFoundError : UserManagementException

kai_unewisse3
Active Contributor
0 Kudos

HI,


i need some help with my first scheduler task in the 7.3 Netweaver :


I am trying to get a XML Document stored in KM


    public Vector<String> initializeUserData(String exceptionList){

  IResourceFactory resurceFactory = null;

  IResource resourceUser = null;

  Document userDoc = null;

  Vector<String> users = new Vector<String>();

  try {

  IServiceUserFactory userfact=UMFactory.getServiceUserFactory();

  IUser tempUser = userfact.getServiceUser("cmadmin_service");

  IResourceContext ctxt = ResourceContext.getInstance(tempUser);

  if (logger.beDebug())

  logger.debugT("initializeData ctxt: " + ctxt);

  RID userNotToChange = RID.getRID(exceptionList);

  resurceFactory = ResourceFactory.getInstance();

  if (logger.beDebug()){

  logger.debugT("initializeData resurceFactory: " + resurceFactory);

  }

  resourceUser  = resurceFactory.getResource(userNotToChange, ctxt);

  userDoc  = parseXML(resourceUser.getContent().getInputStream());

  users = fillUserList(userDoc);

  } catch (ResourceException e) {

  logger.errorT("ResourceException initializeData: " + getStackTrace(e));

  } catch (Exception ex) {

  logger.errorT("Exception initializeData: " + getStackTrace(ex));

  }

  return users;

  }

The result is the following Exception:



avax.ejb.EJBException: nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sapportals/portal/security/usermanagement/UserManagementException

java.lang.RuntimeException: java.lang.NoClassDefFoundError: com/sapportals/portal/security/usermanagement/UserManagementException


which points to the following line :


IResourceContext ctxt = ResourceContext.getInstance(tempUser);





I have referenced the JAR in the build path:

tc~je~usermanagement~api.jar

Any ideas ?



Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

Hi,

The reason is that the ResourceContext in the background references the com.sapportals.portal.security.usermanagement.UsermanagementException. This is not par of the tc~je~usermanagement~api.jar, which only contains the JEE level UME (com.sap.security. ...).

So, as discussed today, a scheduler task which refers to KM should be implemented as a KM scheduler task (and not a scheduled job two layers above).

Best regards

Detlev

Answers (1)

Answers (1)

Sreejith1
Contributor
0 Kudos

Hi Kai,

How you solved this issue?

apart from tc~je~usermanagement~api.jar, whether we have to reference any other?

kai_unewisse3
Active Contributor
0 Kudos

Hi Ram,

I cannot use UME Functions in Scheduler Tasks (which are part of the NW AS and not the portal).

Regards,

Kai

detlev_beutner
Active Contributor
0 Kudos

Hi Kai & Mr. Ram,

> cannot use UME Functions in Scheduler Tasks (which are part of the NW AS and not the portal).

That's not correct. Of course one can use UME functionality in WAS scheduler jobs, and for this the reference tc~je~usermanagement~api.jar is correct and sufficient. In this thread, the original issue came from using KM functionality, which refers to old "portal-subpart-pseudo-UME" classes.

So as long as no KM is addressed but solely WAS functionality (including WAS UME), all this is possible in a WAS scheduler job (and, at the same time, as soon as KM should be used, it is much better design to use KM scheduler tasks for this!).

@Mr Ram: The question if you need to add references depends on what you are developing. The given reference should be sufficient for UME, but if you refer to other stuff, additional references might be needed. But this should be discussed in a new thread with a concrete question - means if you cannot get something running for missing references...

Hope  it clarifies this

Detlev

Sreejith1
Contributor
0 Kudos

Thanks Kai.

I am doing some development with 7.3, which uploads couple of documents to KM folder.

I was using the similar code and struck with same error.

Whether you have any suggestions for me?

java.lang.NoClassDefFoundError: com/sapportals/portal/security/usermanagement/UserManagementException

at com.sap.coll.km.uploadDoc.doContent(uploadDoc.java:63)

Sreejith1
Contributor
0 Kudos

Thanks Detlev,

I will start a new discussion for my issue

detlev_beutner
Active Contributor
0 Kudos

> which uploads couple of documents to KM folder

As said, for technical as well as for design reasons, use a KM scheduler task for this!