cancel
Showing results for 
Search instead for 
Did you mean: 

Sharing References

Former Member
0 Kudos

Hi all,

I have a Web Dynpro application, and I want to use the PortalRuntime class to get a reference to a Portal Service.

At runtime, when the PortalRuntime class is referenced by my code, I get

java.lang.NoClassDefFoundError: com/sapportals/portal/prt/runtime/PortalRuntime 

I've been searching for hours what sharing reference I must use to be able to use this class, without success.

I've two questions:

1. What sharing reference should I use (exactly)? Or is it sth. else I need?

2. Why don't I find any information that tells me how to find out what sharing reference to use for a certain class? Isn't there a list of all available standard SAP sharing references?

Many thanks,

Jeroen

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

right click on your project. pick properties, pick Web Dynpro References, look at last tab Sharing references: Sharing refrences could be:

DC that are used by all another DCs

such as

sap.com/cafUIptn~common if you use the caf layer

sap.com/xappscqmcomp~common if you use the common Dc of cqm xApps

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi ,

To get the service from the portal (after sharing reference):

<someservice> myService =(<someservice>) WDPortalUtils.getServiceReference(<someservice>.KEY);

If you are using DC you will have to add the extra jars to external DC.

Regards Nir

Former Member
0 Kudos

Hi Jeroen,

Select project properties

Webdynpro refrences

Sharing refrences the syntax is:

PORTAL:sap.com/< your service name>

Regards Nir

Former Member
0 Kudos

Concerning 1.: I should be using WDPortalUtils instead of PortalRuntime

Sigiswald
Contributor
0 Kudos

I don't really understand what you mean

e.g. I have this class that reads documents through the KM API


import java.io.IOException;

import org.apache.commons.io.IOUtils;

import com.sapportals.portal.security.usermanagement.IUser;
import com.sapportals.portal.security.usermanagement.UserManagementException;
import com.sapportals.wcm.repository.IResource;
import com.sapportals.wcm.repository.ResourceContext;
import com.sapportals.wcm.repository.ResourceException;
import com.sapportals.wcm.repository.ResourceFactory;
import com.sapportals.wcm.util.content.ContentException;
import com.sapportals.wcm.util.content.IContent;
import com.sapportals.wcm.util.uri.RID;
import com.sapportals.wcm.util.usermanagement.WPUMFactory;

public final class KmService {
  private static final KmService KM_SERVICE = new KmService();
  private static final String PATH =
    "/documents/templates/";
  private static final String USER = "cmadmin_service";

  private KmService() {
  }

  static KmService getInstance() {
    return KM_SERVICE;
  }

  byte[] getTemplate(String id)
    throws UserManagementException, ResourceException, ContentException, IOException {
    if (id.indexOf('/') != -1) {
      throw new IllegalArgumentException("Template names containing "/" not allowed!");
    }

    IUser user = WPUMFactory.getServiceUserFactory().getServiceUser(USER);
    ResourceContext resourceContext = new ResourceContext(user);
    IResource resource =
      ResourceFactory.getInstance().getResource(
        RID.getRID(PATH + id),
        resourceContext);
    IContent content = resource.getContent();

    return IOUtils.toByteArray(content.getInputStream());
  }
}

Do note that I had to create a separate External Library DC that contains the necessary jar files (portal APIs are not available as DCs, so you need to extract them from the server). My Web Dynpro DC then uses the API PP of the External Library DC. My External Library DC currently contains bc.rf.framework_api.jar, bc.sf.framework_api.jar, bc.sf.service.cache_api.jar, bc.util.public_api.jar and com.sap.security.api.ep5.jar (I also need it to use the KM cache service).

There's an interesting post concerning this subject:

Kind regards,

/Sigiswald

Sigiswald
Contributor
0 Kudos

Hi Jeroen,

In order to use any of the portal APIs, the sharing reference in Web Dynpro should be

PORTAL:sap.com/com.sap.km.application

I don't know about any list of standard sharing references (I suppose I once found the one mentioned somewhere on SDN).

Kind regards,

/Sigiswald

Former Member
0 Kudos

Try to add reference with name 'irj' or 'sap.com/irj'