on 02-12-2007 4:26 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jeroen,
Select project properties
Webdynpro refrences
Sharing refrences the syntax is:
PORTAL:sap.com/< your service name>
Regards Nir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Concerning 1.: I should be using WDPortalUtils instead of PortalRuntime
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to add reference with name 'irj' or 'sap.com/irj'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.